fxbit-set? properly handles negative i

This commit is contained in:
Justin Ethier 2021-08-08 21:47:31 -04:00
parent 3cc79395fa
commit fa58b9d538
2 changed files with 8 additions and 2 deletions

View file

@ -10,6 +10,7 @@ Features
Bug Fixes Bug Fixes
- @nmeum fixed `(scheme repl)` to flush the output port prior to writing the prompt, guaranteeing the prompt is written at the correct time. - @nmeum fixed `(scheme repl)` to flush the output port prior to writing the prompt, guaranteeing the prompt is written at the correct time.
- Fixed `fxbit-set?` to properly handle negative values of `i`.
- Avoid unnecessary renaming of identifiers when the interpreter performs macro expansion. - Avoid unnecessary renaming of identifiers when the interpreter performs macro expansion.
- When allocating a large vector we now guarantee all vector elements are initialized before the major collector can trace those elements. This avoids the potential for a race condition which could lead to a segmentation fault. - When allocating a large vector we now guarantee all vector elements are initialized before the major collector can trace those elements. This avoids the potential for a race condition which could lead to a segmentation fault.
- Ensure atomic objects are properly traced by the major garbage collector. - Ensure atomic objects are properly traced by the major garbage collector.

View file

@ -50,7 +50,7 @@
fxarithmetic-shift fxarithmetic-shift
fxarithmetic-shift-left fxarithmetic-shift-right fxarithmetic-shift-left fxarithmetic-shift-right
fxbit-count fxbit-count
fxif fxbit-set? fxcopy-bit fxif fxcopy-bit
fxfirst-set-bit fxfirst-set-bit
fxbit-field fxbit-field
mask mask
@ -170,7 +170,12 @@
(fxior (fxand mask n0) (fxior (fxand mask n0)
(fxand (fxnot mask) n1))) (fxand (fxnot mask) n1)))
(define-c fxbit-set? (define (fxbit-set? index i)
(or (%fxbit-set? index i)
(and (negative? i)
(>= index (fxlength i)))))
(define-c %fxbit-set?
"(void* data, int argc, closure _, object k, object index, object i)" "(void* data, int argc, closure _, object k, object index, object i)"
" Cyc_check_fixnum(data, index); " Cyc_check_fixnum(data, index);
Cyc_check_fixnum(data, i); Cyc_check_fixnum(data, i);