From 3d25a1a67201e5bf9767206908391f0b0484457c Mon Sep 17 00:00:00 2001 From: JeffBezanson Date: Wed, 14 Dec 2011 06:57:25 +0000 Subject: [PATCH] fixing a bug in character-number comparison --- femtolisp/equal.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/femtolisp/equal.c b/femtolisp/equal.c index 59af998..d40548c 100644 --- a/femtolisp/equal.c +++ b/femtolisp/equal.c @@ -79,10 +79,13 @@ static value_t bounded_compare(value_t a, value_t b, int bound, int eq) 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);