hex.add_constant¶
dst[:n] += const
const must be a positive constant.
n_const is the hex-length of const, without all of it’s least-significant-hexes zeros.
Signature¶
def add_constant n, dst, const @ end { ... }
Defined in hex/math.fj — lines 45–48 (view on GitHub).
Complexity¶
Time:
n_const(4@+12) + 5@+2Space:
n_const(2.5@+39) + (dst_n - hex_shift)(1.5@+13) + 4@+29
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 add_constant n, dst, const @ end {
rep(const!=0, _) .add.add_constant_with_leading_zeros n, dst, const, (#(const&(0-const)))-1
end:
}
Used by¶
Example uses¶
hex.ptr_incinhex/pointers/pointer_arithmetics.fjhex.ptr_addinhex/pointers/pointer_arithmetics.fj
← Previous: hex.add_shifted
Next: hex.add.add_constant_with_leading_zeros →