hex.ptr_index¶
dst[:w/4] = ptr + index*2w — the address of the index-th dw-aligned op past *ptr.
dst, ptr are hex[:w/4]; index is a signed hex[:w/4]. Works for negative index too.
@Assumes: w in {16, 32, 64, 128}.
Signature¶
def ptr_index dst, ptr, index { ... }
Defined in hex/pointers/pointer_arithmetics.fj — lines 45–51 (view on GitHub).
Complexity¶
Time:
w(2.25@+5.25) // for w=64Space:
w(2.25@+40) // for w=64
See the complexity glossary for what @, w, dw, dbit, n mean.
Requires init¶
The following must be initialised before this macro is invoked:
hex.add.init (or hex.init)
Source¶
Click to view the macro body
def ptr_index dst, ptr, index {
.mov w/4, dst, index
.shl_hex w/4, dst
rep(8-#w, i) .shr_bit w/4, dst
.shl_hex w/4, dst
.add w/4, dst, ptr
}
Depends on¶
Used by¶
Example uses¶
hex.read_nth_hexinhex/pointers/read_pointers.fjhex.read_nth_byteinhex/pointers/read_pointers.fjhex.write_nth_hexinhex/pointers/write_pointers.fj
← Previous: hex.ptr_sub