bit.div10.cmp_sub_10¶
if (val > 10) {
val -= 10;
res = !res;
}
for val4:val[3,2,1,0] of length 5, and Assumes val <= 19.
This macro is getting called on consecutive 5-bits, shifting the 5-bit-frame 1 bit right at a time.
Signature¶
def cmp_sub_10 val4, val, res @ yes, no, _1xxxx, _1xx0x, _1xx1x, _01x1x, _0110x { ... }
Defined in bit/div.fj — lines 23–48 (view on GitHub).
Complexity¶
Time:
4@+12Space:
4@+12
See the complexity glossary for what @, w, dw, dbit, n mean.
Source¶
Click to view the macro body
def cmp_sub_10 val4, val, res @ yes, no, _1xxxx, _1xx0x, _1xx1x, _01x1x, _0110x {
..if1 val4, _1xxxx
..if0 val+3*dw, no
..if1 val+ dw, _01x1x
..if0 val+2*dw, no
_0110x:
..not val+2*dw
val+3*dw+dbit; yes
_01x1x:
val+3*dw+dbit; yes
_1xxxx:
..not val4
..if val+dw, _1xx0x, _1xx1x
_1xx0x:
val+2*dw+dbit; yes
_1xx1x:
val+3*dw+dbit; yes
yes:
..not val+dw
..not res
no:
}
Depends on¶
Used by¶
Example uses¶
bit.div10inbit/div.fj