shithub: femtolisp

Download patch

ref: 3d25a1a67201e5bf9767206908391f0b0484457c
parent: 3f4b26a46f907a6c4641512a6e3d6f4c90937f69
author: JeffBezanson <jeff.bezanson@gmail.com>
date: Wed Dec 14 01:57:25 EST 2011

fixing a bug in character-number comparison


--- a/femtolisp/equal.c
+++ b/femtolisp/equal.c
@@ -79,10 +79,13 @@
             return bounded_vector_compare(a, b, bound, eq);
         break;
     case TAG_CPRIM:
-        if (cp_class((cprim_t*)ptr(a)) == wchartype &&
-            (!iscprim(b) ||
-             cp_class((cprim_t*)ptr(b)) != wchartype))
-            return fixnum(-1);
+        if (cp_class((cprim_t*)ptr(a)) == wchartype) {
+            if (!iscprim(b) || cp_class((cprim_t*)ptr(b)) != wchartype)
+                return fixnum(-1);
+        }
+        else if (iscprim(b) && cp_class((cprim_t*)ptr(b)) == wchartype) {
+            return fixnum(1);
+        }
         c = numeric_compare(a, b, eq, 1, NULL);
         if (c != 2)
             return fixnum(c);