hex.tables.clean_table_entry__table (arity 3)¶
Generic n-entry XOR-dispatch table: when jumped to at entry d, XORs d into dst and jumps to ret. n must be a power of two and the table must be (1<<n)-padded. The 1-arity form specialises this to n=256, ret=hex.tables.ret.
Signature¶
def clean_table_entry__table n, dst, ret @ clean { ... }
Defined in hex/tables_init.fj — lines 46–51 (view on GitHub).
Complexity¶
Time:
log(n) / 2 (an overage over all entries, of jumping to an entry in this table)Space:
n
See the complexity glossary for what @, w, dw, dbit, n mean.
Source¶
Click to view the macro body
def clean_table_entry__table n, dst, ret @ clean {
clean:
rep(n, d) stl.fj \
d==0?0: (dst+dbit+(#d)-1), \
(d==((1<<(#d))>>1)) ? ret : clean+(d^((1<<(#d))>>1))*dw
}
Used by¶
Example uses¶
hex.add_count_bitsinhex/math_basic.fjhex.shifts.shl_bit_onceinhex/shifts.fjhex.shifts.shr_bit_onceinhex/shifts.fj
← Previous: hex.tables.init_all
Next: hex.tables.clean_table_entry__table/1 →