hex.add_shiftedΒΆ
dst[:dst_n] += src[:src_n] << (4*hex_shift)
SignatureΒΆ
def add_shifted dst_n, src_n, dst, src, hex_shift @ do_inc, end { ... }
Defined in hex/math.fj β lines 30β37 (view on GitHub).
ComplexityΒΆ
Time:
src_n(4@+12) + 5@+1 // It's on average, see the note in hex.inc.Space:
src_n(2.5@+39) + (dst_n - hex_shift)(1.5@+13) + 4@+28
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_shifted dst_n, src_n, dst, src, hex_shift @ do_inc, end {
.add.clear_carry
rep(src_n, i) .add dst+(hex_shift + i)*dw, src+i*dw
.add.clear_carry end, do_inc
do_inc:
rep(dst_n - (src_n + hex_shift), i) .inc.step dst+(src_n + hex_shift + i)*dw, end
end:
}
Depends onΒΆ
Used byΒΆ
Example usesΒΆ
hex.add.add_hex_shifted_constantinhex/math.fj
β Previous: hex.add/3
Next: hex.add_constant β