Added fxarithmetic-shift

This commit is contained in:
Justin Ethier 2017-08-08 13:19:38 +00:00
parent 390192db2a
commit 1a3f60711f

View file

@ -25,7 +25,7 @@
; fx+/carry fx-/carry fx*/carry ; fx+/carry fx-/carry fx*/carry
fxnot fxand fxior fxxor fxnot fxand fxior fxxor
;fxarithmetic-shift fxarithmetic-shift
fxarithmetic-shift-left fxarithmetic-shift-right fxarithmetic-shift-left fxarithmetic-shift-right
; fxbit-count fxlength fxif fxbit-set? fxcopy-bit ; fxbit-count fxlength fxif fxbit-set? fxcopy-bit
; fxfirst-set-bit fxbit-field ; fxfirst-set-bit fxbit-field
@ -43,7 +43,7 @@
fxsquare fxsquare
fxabs fxabs
fxnot fxand fxior fxxor fxnot fxand fxior fxxor
;fxarithmetic-shift fxarithmetic-shift
fxarithmetic-shift-left fxarithmetic-shift-right fxarithmetic-shift-left fxarithmetic-shift-right
) )
(begin (begin
@ -121,7 +121,10 @@
(bin-num-op fxand "&") (bin-num-op fxand "&")
(bin-num-op fxior "|") (bin-num-op fxior "|")
(bin-num-op fxxor "^") (bin-num-op fxxor "^")
;fxarithmetic-shift (define (fxarithmetic-shift i count)
(if (fxpositive? count)
(fxarithmetic-shift-left i count)
(fxarithmetic-shift-right i (fxneg count))))
(bin-num-op fxarithmetic-shift-left "<<") (bin-num-op fxarithmetic-shift-left "<<")
(bin-num-op fxarithmetic-shift-right ">>") (bin-num-op fxarithmetic-shift-right ">>")
)) ))