diff --git a/scheme/ikarus.numerics.ss b/scheme/ikarus.numerics.ss index 3e219c5..5ca9055 100644 --- a/scheme/ikarus.numerics.ss +++ b/scheme/ikarus.numerics.ss @@ -2889,7 +2889,8 @@ (export fxfirst-bit-set bitwise-first-bit-set fxbit-count bitwise-bit-count fxlength - fxbit-set?) + fxbit-set? + fxcopy-bit) (import (ikarus system $fx) (ikarus system $bignums) @@ -2898,7 +2899,8 @@ fxfirst-bit-set bitwise-first-bit-set fxbit-count bitwise-bit-count fxlength - fxbit-set?)) + fxbit-set? + fxcopy-bit)) (module (bitwise-first-bit-set fxfirst-bit-set) (define (byte-first-bit-set x i) @@ -3012,6 +3014,18 @@ (error who "index is not a fixnum" i)) (error who "not a fixnum" x))) + (define (fxcopy-bit x i b) + (define who 'fxcopy-bit) + (if (fixnum? x) + (if (fixnum? i) + (if (and ($fx<= 0 i) ($fx< i (fixnum-width))) + (case b + [(0) ($fxlogand x ($fxlognot ($fxsll 1 i)))] + [(1) ($fxlogor x ($fxsll 1 i))] + [else (error who "invalid bit value" b)]) + (error who "index out of range" i)) + (error who "index is not a fixnum" i)) + (error who "not a fixnum" x))) ) diff --git a/scheme/makefile.ss b/scheme/makefile.ss index 2ed2939..bd1d721 100755 --- a/scheme/makefile.ss +++ b/scheme/makefile.ss @@ -789,7 +789,7 @@ [fxbit-count i r fx] [fxbit-field r fx] [fxbit-set? i r fx] - [fxcopy-bit r fx] + [fxcopy-bit i r fx] [fxcopy-bit-field r fx] [fxdiv i r fx] [fxdiv-and-mod i r fx] diff --git a/scheme/todo-r6rs.ss b/scheme/todo-r6rs.ss index bcf64d7..157804d 100755 --- a/scheme/todo-r6rs.ss +++ b/scheme/todo-r6rs.ss @@ -291,7 +291,7 @@ [fxbit-count C fx] [fxbit-field S fx] [fxbit-set? C fx] - [fxcopy-bit S fx] + [fxcopy-bit C fx] [fxcopy-bit-field S fx] [fxdiv C fx] [fxdiv-and-mod C fx]