hex.and.init¶
This is where the and “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 and operation).
Its 8-bits are expected to be 0 after the jump to it.
Signature¶
def init @ switch, clean_table_entry, end < ..tables.res > dst { ... }
Defined in hex/logics.fj — lines 338–358 (view on GitHub).
Complexity¶
Time:
6 (when jumping to dst, until finished)Space:
595
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.res > dst {
;end
dst: ;.switch
pad 256
switch:
// The next line is the bitwise-and flipping-table.
// The [src<<4 | dst] entry sets hex.tables.res (assumed to be 0) to (dst & src) ^ dst,
// so that xoring it with dst will update it to the and-result.
// Upon entering here, .dst was xored with the correct table-entry, and was jumped into.
// Space Complexity / total table ops: 337.
rep(256, d) stl.wflip_macro \
..tables.res+w, \
(((d&0xf)&(d>>4))^(d&0xf))*dw, \
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.and/3