bit.hex2asciiΒΆ
ascii := the ascii representation of the value of hex (digits & capital-letters).
ascii is bit[:8], hex is bit[:4].
SignatureΒΆ
def hex2ascii ascii, hex @ dec_label, hex_label, nine4, end { ... }
Defined in bit/casting.fj β lines 42β57 (view on GitHub).
ComplexityΒΆ
Time:
15@+7Space:
21@+30
See the complexity glossary for what @, w, dw, dbit, n mean.
SourceΒΆ
Click to view the macro body
def hex2ascii ascii, hex @ dec_label, hex_label, nine4, end {
.zero 8, ascii
.xor 3, ascii, hex
.cmp 4, hex, nine4, dec_label, dec_label, hex_label
dec_label:
.xor ascii+3*dw, hex+3*dw
.not 2, ascii + 4*dw // ascii = 0x30
;end
hex_label:
.dec 3, ascii // A-F is now 1-6
.not ascii + 6*dw // ascii = 0x40
;end
nine4:
.vec 4, 9
end:
}
Depends onΒΆ
Used byΒΆ
Example usesΒΆ
bit.print_hex_uint.print_digitinbit/output.fj
β Previous: bit.dec2ascii
Next: bit.ascii2bin β