-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 23-Sep-06, at 4:29 PM, Bradley Lucier wrote:
Marc:
I found a few more problems---in FIXLENGTH you want to set ___temp to -___temp (not ~temp) when ___temp is negative (try (fxlength -1)),
This is incorrect. Note that the definition of fxlength in R6RS uses ~temp (SRFI 77 erroneously used -temp). With ~temp it matches the Common Lisp semantics, i.e. (fxlength -1) = 0.
and you needed to ___FIX(___temp&0xff) in 64-bit ___BITCOUNT_TEMP..
Thanks.
I imagine that using some configurey to use gcc's __builtin_popcountl, __builtin_ffsl, and __builtin_clzl when available would speed up these functions in some special cases.
Probably, but I couldn't figure out how to test if these builtins are available and I don't want to spend too much time on this.
This has been rather extensively tested on 32-bit (ppc) and 64-bit (x86-64) platforms by comparing it with the R6RS definitions of the same functions. The diff is from the original gambit.h.
For (fxfirst-bit-set 0) the R6RS specifies that -1 should be returned. I see no reason why -1 should be viewed as the correct answer. It seems too arbitrary. The "Scheme way" is to return #f, in fact that's what Gambit's (first-set-bit 0) returns. What do you think?
Marc