mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 12:35:05 +02:00
Added bit-set
This commit is contained in:
parent
a247ba03ad
commit
be11ed674f
1 changed files with 8 additions and 2 deletions
10
srfi/143.sld
10
srfi/143.sld
|
@ -28,7 +28,7 @@
|
||||||
fxarithmetic-shift
|
fxarithmetic-shift
|
||||||
fxarithmetic-shift-left fxarithmetic-shift-right
|
fxarithmetic-shift-left fxarithmetic-shift-right
|
||||||
; fxbit-count fxlength
|
; fxbit-count fxlength
|
||||||
fxif ;fxbit-set? fxcopy-bit
|
fxif fxbit-set? ;fxcopy-bit
|
||||||
; fxfirst-set-bit fxbit-field
|
; fxfirst-set-bit fxbit-field
|
||||||
; fxbit-field-rotate fxbit-field-reverse
|
; fxbit-field-rotate fxbit-field-reverse
|
||||||
)
|
)
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
fxnot fxand fxior fxxor
|
fxnot fxand fxior fxxor
|
||||||
fxarithmetic-shift
|
fxarithmetic-shift
|
||||||
fxarithmetic-shift-left fxarithmetic-shift-right
|
fxarithmetic-shift-left fxarithmetic-shift-right
|
||||||
fxif
|
fxif fxbit-set?
|
||||||
)
|
)
|
||||||
(begin
|
(begin
|
||||||
(define (fx-width) 31)
|
(define (fx-width) 31)
|
||||||
|
@ -134,5 +134,11 @@
|
||||||
(bin-num-op fxarithmetic-shift-right ">>")
|
(bin-num-op fxarithmetic-shift-right ">>")
|
||||||
(define (fxif mask i j)
|
(define (fxif mask i j)
|
||||||
(fxior (fxand (fxnot mask) i) (fxand mask j)))
|
(fxior (fxand (fxnot mask) i) (fxand mask j)))
|
||||||
|
(define-c fxbit-set?
|
||||||
|
"(void* data, int argc, closure _, object k, object index, object i)"
|
||||||
|
" Cyc_check_fixnum(data, index);
|
||||||
|
Cyc_check_fixnum(data, i);
|
||||||
|
int result = ((obj_obj2int(i)) & (1 << (obj_obj2int(index))));
|
||||||
|
return_closcall1(data, k, result ? boolean_t : boolean_f); ")
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue