fixnum-shift-fast subprimitive

db4
Slava Pestov 2008-11-03 00:03:39 -06:00
parent 1aefde994f
commit dd20b39cd6
1 changed files with 15 additions and 0 deletions

View File

@ -302,6 +302,21 @@ big-endian off
ds-reg [] arg0 MOV ! save
] f f f \ fixnum-bitnot define-sub-primitive
[
ECX ds-reg [] MOV ! load shift count
ECX tag-bits get SHR ! untag shift count
ds-reg bootstrap-cell SUB ! adjust stack pointer
arg0 ds-reg [] MOV ! load value
arg1 arg0 MOV ! make a copy
arg1 CL SHL ! compute positive shift value in arg1
ECX NEG ! compute negative shift value in arg0
arg0 CL SHR
arg0 tag-mask get bitnot AND
ECX 0 CMP ! if shift count was negative, move arg0 to arg1
arg1 arg0 CMOVLE
ds-reg [] arg1 MOV ! push to stack
] f f f \ fixnum-shift-fast define-sub-primitive
[
arg0 ds-reg [] MOV ! load local number
fixnum>slot@ ! turn local number into offset