Fixed-limb product runtime #
Carry-preserving addition and full products operate over one, two, and four native limbs. The
explicit UInt256 carrier is large enough for the exact product of two UInt128 values, so the
product needs no arbitrary-precision conversion.
Product.Proof shows that each returned value and carry reconstruct the exact natural-number
sum or product.
A fixed-width addition result together with its unsigned carry.
- value : α
Low fixed-width part of the exact sum.
- carry : UInt64
Carry above the payload's highest bit, represented as a native word.
Instances For
Instances For
Instances For
Add two native words and retain the unsigned carry.
Instances For
Add two words and an incoming carry.
Instances For
Add two two-word values.
Instances For
Instances For
Embed a two-limb unsigned value in the low half of a four-limb carrier.
Instances For
Embed a two-limb value after shifting it left by shift bits, for 64 < shift < 128.
The two-word kernels for formats of at most 128 bits align a fracWidth + 1-bit significand by
fracWidth or fracWidth + 1 places, so division, fused multiply-add, and square root share this
one word shuffle. toNat_ofUInt128ShiftedLeft gives its value under the stated shift bounds;
outside them the native shift counts wrap and the result is unspecified.
Instances For
Return the low two limbs of a four-limb unsigned value.
Instances For
Mathematical value of a four-limb unsigned integer.
Instances For
Position of the most significant set bit, with zero mapped to zero.
Instances For
Add two four-word values.
Instances For
Exact native multiplication of two two-limb values.
Four mul64 products form the schoolbook product. Each output column is reduced with add64, and
the resulting carry count is passed to the next column.