Albedo
Joined 24 August 2022
m
→Binary Digits
m (→Binary Digits) |
|||
Line 273:
l1: = : duplicate number
2X/= : divide n by 2 and duplicate the result
1X!>#: is the result >0? (is n>=2?) It is, thus rotate the pointer by 1 (downwards, continue at l2) and go through the loop
2X1X@: move the result down (needed for further processing), and move n to the top of the stack
2X% : n mod 2 (remainder, last binary digit)
2X1X@: move binary digit down, move result of division up
loop is finished, back to the beginning (l1)
2X/= : divide n by 2 and duplicate the result
1X!>#: is the result >0? (is n>=2?) It is not, thus don’t rotate the pointer and move on (to l3)
|