bit.ptr_flip_dbit¶
The stl.comp_flip_if executes in ~##w, which should be much less than @/2 operations.
Effectively: (*ptr)+dbit;
Flip the address dbit-ahead of what the pointer points to.
ptr is a bit[:w] that holds an address, which we assume is dw-aligned.
Signature¶
def ptr_flip_dbit ptr { ... }
Defined in bit/pointers.fj — lines 88–92 (view on GitHub).
Complexity¶
Time:
2w@ + 2@Space:
2w@ + 2@
See the complexity glossary for what @, w, dw, dbit, n mean.
Requires init¶
The following must be initialised before this macro is invoked:
bit.pointers.ptr_init
Source¶
Click to view the macro body
def ptr_flip_dbit ptr {
rep(#dbit, i) stl.comp_flip_if ptr+dbit+i*dw, (dbit>>i)&1
.ptr_flip ptr
rep(#dbit, i) stl.comp_flip_if ptr+dbit+i*dw, (dbit>>i)&1
}
Depends on¶
Used by¶
Example uses¶
bit.xor_to_ptrinbit/pointers.fj
← Previous: bit.ptr_flip
Next: bit.xor_to_ptr →