Skip to main content

Module ops

Module ops 

Source

Modules§

bits
Bit-manipulation operations beyond PrimInt: unbounded and funnel shifts, exact (lossless) shifts, bit isolation/indexing, bit width and PDEP/PEXT-style bit deposit/extract, mirroring the corresponding inherent methods on the primitive integer types.
byte_slice
Parsing an unsigned integer from a byte slice of arbitrary length.
bytes
carrying
Carry/borrow-propagating and widening integer-arithmetic primitives for chaining multi-word (“bigint”) arithmetic, mirroring std’s unstable bigint_helper_methods (carrying_add / borrowing_sub / carrying_mul / widening_mul). For unsigned types these stabilized in Rust 1.91; the signed forms and widening_mul are still unstable.
checked
Checked arithmetic: None on overflow.
clmul
Carry-less (“polynomial” / GF(2)) multiplications — the clmul / PCLMULQDQ family used by GHASH, CRC, and similar bit-polynomial codes. Each partial product is XORed (rather than added) into the accumulator, so there is no carry to propagate: a distinct domain from the integer arithmetic in crate::ops::carrying.
convert
Integer-to-integer conversions: sign reinterpretation, absolute difference, value-preserving widening, lossy truncation, and the generic cast family, mirroring cast_signed / cast_unsigned / unsigned_abs / abs_diff / widen / truncate / {checked,wrapping,saturating,strict}_cast / clamp_magnitude on the primitive integer types.
ctct
Constant-time (masked-return) counterparts of the Tier-B atoms, built on subtle’s Choice and CtOption. Only available with the ct cargo feature.
euclid
Euclidean division and remainder.
float_ops
Float atoms outside the big verbatim-upstream Float/FloatCore bundles: bit-pattern access, ULP stepping, IEEE 754-2019 min/max, round-half-to-even, the algebraic_* fast-math family and the libm-backed special functions.
from_ascii
Integer parsing from ASCII byte strings, mirroring the still-unstable from_ascii / from_ascii_radix inherent methods (int_from_ascii).
inv
log
Integer logarithms, mirroring the ilog2 / ilog10 / ilog inherent methods (stable in std since Rust 1.67) and their checked variants.
mixed
Mixed-signedness arithmetic: adding/subtracting a signed value to an unsigned one and vice versa, plus the signed difference of unsigned values. Mirrors the *_add_signed / *_sub_signed / *_add_unsigned / *_sub_unsigned / checked_signed_diff inherent methods.
mul_add
overflowing
Overflowing arithmetic: the wrapped value plus an overflow flag.
parity
Parity (odd/even) checks.
pow2
Power-of-two operations on unsigned integers, mirroring is_power_of_two / next_power_of_two / checked_next_power_of_two (stable since Rust 1.0) and the still-unstable wrapping_next_power_of_two.
rounding
Division-rounding and related operations: div_ceil, div_floor, exact division, multiple-of computations and overflow-free midpoint, mirroring the inherent methods on the primitive integer types.
saturating
Saturating arithmetic.
sqrt
Integer square root, mirroring the isqrt / checked_isqrt inherent methods (stable in std since Rust 1.84).
strict
Strict arithmetic: like the unchecked operators but guaranteed to panic on overflow in every build profile, mirroring the strict_* inherent methods on the primitive integer types (stable in std since Rust 1.91).
typestate
Zero-cost typestate proofs.
wrapping
Wrapping (modular) arithmetic.