Fix 'fxbit-count' for negative arguments.
authorMark H Weaver <mhw@netris.org>
Tue, 16 Jul 2013 16:06:45 +0000 (12:06 -0400)
committerMark H Weaver <mhw@netris.org>
Tue, 16 Jul 2013 16:06:45 +0000 (12:06 -0400)
commita1c9ecf0a46fb3b09a268030f790aa487d38a433
tree22ad2c26ff11e33e06aba33e33f12d5d72868b46
parent3bbca1f7237c0e9d9419eaea8f274c9cd7314f04
Fix 'fxbit-count' for negative arguments.

Reported by Göran Weinholt <goran@weinholt.se>.

* module/rnrs/arithmetic/fixnums.scm (fxbit-count): If the argument is
  negative, return the 'bitwise-not' of the result of 'logcount', as per
  R6RS.  Previously, 'fxbit-count' was identical to 'logcount'.

* test-suite/tests/r6rs-arithmetic-fixnums.test (fxbit-count): Add test.
module/rnrs/arithmetic/fixnums.scm
test-suite/tests/r6rs-arithmetic-fixnums.test