You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sweeping all the 1s in a number up ( dup 2* or ), repeatedly, sets bit 15 if non zero.
Since we can look at the stack, at any byte, half way between two 16 bit words, we can swap the upper and lower bytes. This moves bit 15 to bit 7 and bit 8 to bit 0. ( dup sp@ 1 + @ swap drop swap drop )
Shifting the result left by one ( 2* ) moves the original bit 15 to bit 8. Swapping again moves it to bit 0.
Mask only bit 0, invert and add 1 to make it a flag for 0<>
( 1 and invert 1 + )
invert again if you want 0=
It's much slower than a primitive, but saves a little .asm space.
Does that make 6 ?
The text was updated successfully, but these errors were encountered:
We can derive 0= very early in a .f file.
Sweeping all the 1s in a number up ( dup 2* or ), repeatedly, sets bit 15 if non zero.
Since we can look at the stack, at any byte, half way between two 16 bit words, we can swap the upper and lower bytes. This moves bit 15 to bit 7 and bit 8 to bit 0. ( dup sp@ 1 + @ swap drop swap drop )
Shifting the result left by one ( 2* ) moves the original bit 15 to bit 8. Swapping again moves it to bit 0.
Mask only bit 0, invert and add 1 to make it a flag for 0<>
( 1 and invert 1 + )
invert again if you want 0=
It's much slower than a primitive, but saves a little .asm space.
Does that make 6 ?
The text was updated successfully, but these errors were encountered: