It may be useful to perform constant-time arithmetic on primitive unsigned integers. While it might be ideal to keep all such operations within this library's Uint type, this seems unlikely in practice. I came across this exact situation while solving a problem requiring simple constant-time arithmetic on unsigned integers that eventually needed to be used in contexts that couldn't use Uint directly.
This PR adds to_u64 to Uint in the style of the existing from_u64 functionality. It requires a single limb, and simply extracts the underlying word as a u64 (depending on the target).
It may be useful to perform constant-time arithmetic on primitive unsigned integers. While it might be ideal to keep all such operations within this library's
Uint
type, this seems unlikely in practice. I came across this exact situation while solving a problem requiring simple constant-time arithmetic on unsigned integers that eventually needed to be used in contexts that couldn't useUint
directly.This PR adds
to_u64
toUint
in the style of the existingfrom_u64
functionality. It requires a single limb, and simply extracts the underlying word as au64
(depending on the target).