hex.print_as_digit (arity 2)ΒΆ
prints the ascii of the hexadecimal representation of hex.
use_uppercase (constant): if true, print in uppercase (else lowercase).
SignatureΒΆ
def print_as_digit hex, use_uppercase @ switch, print_0, print_2, print_4, print_6, print_8, print_a, print_b, print_d, print_f, end < stl.IO { ... }
Defined in hex/output.fj β lines 85β144 (view on GitHub).
ComplexityΒΆ
Time:
@+4Space:
@+36
See the complexity glossary for what @, w, dw, dbit, n mean.
SourceΒΆ
Click to view the macro body
def print_as_digit hex, use_uppercase @ switch, print_0, print_2, print_4, print_6, print_8, \
print_a, print_b, print_d, print_f, end < stl.IO {
wflip hex+w, switch, hex
pad 16
switch:
stl.IO+0;print_0 // 0
stl.IO+1;print_0 // 1
stl.IO+0;print_2 // 2
stl.IO+1;print_2 // 3
stl.IO+0;print_4 // 4
stl.IO+1;print_4 // 5
stl.IO+0;print_6 // 6
stl.IO+1;print_6 // 7
stl.IO+0;print_8 // 8
stl.IO+1;print_8 // 9
stl.IO+1;print_a // a
stl.IO+0;print_b // b
stl.IO+1;print_b // c
stl.IO+0;print_d // d
stl.IO+1;print_d // e
stl.IO+0;print_f // f
print_0: // outputs 0x30
stl.IO+0;
stl.IO+0;
stl.IO+0;
stl.IO+1;
stl.IO+1;
stl.IO+0;
stl.IO+0;end
print_2:
stl.IO+1;print_0+1*dw
print_4:
stl.IO+0;
stl.IO+1;print_0+2*dw
print_6:
stl.IO+1;print_4+1*dw
print_8:
stl.IO+0;
stl.IO+0;
stl.IO+1;print_0+3*dw
print_a: // outputs 0x40 / 0x60
stl.IO+0;
stl.IO+0;
stl.IO+0;
stl.IO+0;
stl.IO+(use_uppercase ? 0 : 1);
stl.IO+1;print_0+6*dw
print_b:
stl.IO+1;print_a+1*dw
print_d:
stl.IO+0;
stl.IO+1;print_a+2*dw
print_f:
stl.IO+1;print_d+1*dw
end:
wflip hex+w, switch
}
Used byΒΆ
Example usesΒΆ
hex.print_uint.print_digitinhex/output.fj
β Previous: hex.print/2
Next: hex.print_as_digit/3 β