bit.ascii2bin¶
if ascii is ‘0’/’1’, set bit to 0/1 (end error=0). else, set error=1.
ascii is bit[:8], and error(output-param),bin are bits.
Signature¶
def ascii2bin error, bin, ascii @ half_bin, return_error, copy_binary_value, end { ... }
Defined in bit/casting.fj — lines 69–87 (view on GitHub).
Complexity¶
Time:
17@+24Space:
17@+24
See the complexity glossary for what @, w, dw, dbit, n mean.
Source¶
Click to view the macro body
def ascii2bin error, bin, ascii @ half_bin, return_error, copy_binary_value, end {
.zero error
.zero bin
.cmp 7, ascii+dw, half_bin, return_error, copy_binary_value, return_error
return_error:
.not error
;end
copy_binary_value:
.xor bin, ascii
;end
half_bin:
.vec 7, 0x30>>1
end:
}
Depends on¶
← Previous: bit.hex2ascii
Next: bit.ascii2dec →