hex/math.fjΒΆ
βββ- Addition / Subtraction:
MacrosΒΆ
hexΒΆ
hex.add/2β dst += srchex.add/3β dst[:n] += src[:n]hex.add_shiftedβ dst[:dst_n] += src[:src_n] << (4*hex_shift)hex.add_constantβ dst[:n] += consthex.sub/2β dst -= srchex.sub/3β dst[:n] -= src[:n]hex.sub_shiftedβ dst[:dst_n] -= src[:src_n] << (4*hex_shift)hex.sub_constantβ dst[:dst_n] -= const
hex.addΒΆ
hex.add.add_hex_shifted_constant/5β dst[:dst_n] += const << (4*hex_shift)hex.add.clear_carry/0β carry = 0hex.add.clear_carry/2β carry = 0. jump to c0 if it was 0, and to c1 otherwise.hex.add.not_carryβ carry = !carryhex.add.set_carryβ carry = 1hex.add.initβ This is where the add βtruthβ tables are.
hex.subΒΆ
hex.sub.sub_hex_shifted_constant/5β dst[:dst_n] -= const << (4*hex_shift)hex.sub.clear_carry/0β carry = 0hex.sub.clear_carry/2β carry = 0. jump to c0 if it was 0, and to c1 otherwise.hex.sub.not_carryβ carry = !carryhex.sub.set_carryβ carry = 1hex.sub.initβ This is where the sub βtruthβ tables are. must be called once if you want to use hex.sub (hex.init calls it).