hex.cmp.init¶
This is where the compare “truth” tables are.
Its 8-bits are expected to be {src<<4 | dst} at the jump to it (for the src,dst hexes of the cmp operation).
Its 8-bits are expected to be 0 after the jump to it.
Signature¶
def init @ switch, clean_table_entry, end < ..tables.ret > dst { ... }
Defined in hex/cond_jumps.fj — lines 139–160 (view on GitHub).
Complexity¶
Time:
6 (when jumping to dst, until finished)Space:
514
See the complexity glossary for what @, w, dw, dbit, n mean.
Requires init¶
The following must be initialised before this macro is invoked:
hex.tables.init_shared (or hex.init)
Output labels¶
This macro exposes labels into the caller’s scope via >:
dst— This variable is an 8-bit variable (in a single op, [dbit,dbit+8)).
Source¶
Click to view the macro body
def init @ switch, clean_table_entry, end < ..tables.ret > dst {
;end
dst: ;.switch
pad 256
switch:
// The next line is the compare flipping-table.
// The [src<<4 | dst] entry flips bits in hex.tables.ret:
// if dst > src: flips dbit+1
// if dst == src: flips dbit+0
// if dst < src: no flips
// Upon entering here, .dst was xored with the correct table-entry, and was jumped into.
rep(256, d) stl.fj ((d&0xf) > (d>>4)) \
? ..tables.ret+dbit+1 \
: (((d&0xf) == (d>>4)) ? ..tables.ret+dbit : 0),\
clean_table_entry+d*dw
clean_table_entry:
// xors back the table-entry from .dst
..tables.clean_table_entry__table .dst
end:
}
Depends on¶
Used by¶
Example uses¶
hex.tables.init_allinhex/tables_init.fj
← Previous: hex.cmp.cmp_eq_next
Next: hex.min →