guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Bring `bitwise-copy-bit' behavior back in line with R6RS.


From: Julian Graham
Subject: [PATCH] Bring `bitwise-copy-bit' behavior back in line with R6RS.
Date: Sat, 16 Sep 2017 20:17:56 -0400

Hi Guilers!

It looks like there was a subtle but significant regression introduced
to the behavior of `bitwise-copy-bit' in `(rnrs arithmetic bitwise)'
back in 93da406f33.

R6RS says [0] that function (with arguments EI1, EI2, EI3) should
transfer the EI2th bit from EI3 to EI1, but Guile's implementation was
always reading the 0th bit from EI3. This patch brings the
implementation back in line with the standard.

`fxcopy-bit' in `(rnrs artihmetic fixnum)' gets touched as well, since
it was relying on `bitwise-copy-bit'. Its behavior per R6RS is a
little different [1] in that its third argument _is_ the bit to be
set, so it's just easier to use SRFI-60's `copy-bit' to take its
value.

Any questions? Let me know.


Regards,
Julian


[0] - http://www.r6rs.org/final/html/r6rs-lib/r6rs-lib-Z-H-12.html#node_sec_11.4
[1] - http://www.r6rs.org/final/html/r6rs-lib/r6rs-lib-Z-H-12.html#node_sec_11.2

Attachment: 0001-Bring-bitwise-copy-bit-behavior-back-in-line-with-R6.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]