shhyou / ypsilon-fork

Automatically exported from code.google.com/p/ypsilon
Other
0 stars 0 forks source link

(bitwise-bit-count 0) returns a wrong result #123

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
These should return zero:

> (bitwise-bit-count 0)
-65
> (fxbit-count 0)
-65

Original issue reported on code.google.com by weinh...@gmail.com on 22 Aug 2009 at 9:04

GoogleCodeExporter commented 9 years ago
My guess is as follows:

Index: src/arith.cpp
===================================================================
--- src/arith.cpp   (revision 503)
+++ src/arith.cpp   (working copy)
@@ -2570,7 +2570,7 @@
 {
     if (FIXNUMP(obj)) {
         intptr_t n = FIXNUM(obj);
-        if (n > 0) {
+        if (n >= 0) {
             return MAKEFIXNUM(nbits(n));
         } else {
             return MAKEFIXNUM(~nbits(~n));

Original comment by tabe.fix...@gmail.com on 27 Aug 2009 at 1:37