ruint
Unsigned integer type with const-generic bit length
1.20.0
26M downloads/mo
#1832 most downloaded on crates.io
alloy-rs/ruint
What this package is like to depend on
Last release 24 days ago
30 Jul 2026
Ships fairly regularly
a new release about every 2 months
Nearly every release is documented
notes for 35 of 35 stable releases
Nothing withdrawn
no release was ever pulled
4 years old
35 releases · first in 2022
6 releases in the last 12 months
see the full history below
Release timeline
35 releases · May 2022 to Jul 2026Releases
latest 35-
1.20.030 Jul 2026Release notes
Open source →What's Changed
- fix(algorithms): close soundness and safety-contract gaps by @prestwich in #612
- docs: fix incorrect comments in add/mul/gcd algorithms by @prestwich in #611
- fix: checked_log/log2/log10 panic on tiny bit-widths by @prestwich in #610
- ci: run core test suite on wasm32-wasip1 by @prestwich in #609
- fix: str radix errors now by @prestwich in #608
- fix: try_from_*_slice returns None instead of panicking for BITS % 64 in 57..=63 by @prestwich in #607
- fix: reject non-finite f64 and saturate Uint→f64 at 2^1024 by @prestwich in #606
- z by @prestwich in #605
- chore: infer rustfmt edition by @DaniPopes in #619
- feat: make more Uint methods const by @DaniPopes in #614
- docs: add agent guidelines by @DaniPopes in #618
- perf: open-code Uint PartialEq and is_zero on riscv to avoid memcmp libcall by @Qumeric in #604
- fix: overflowing_shl/overflowing_shr overflow-flag false negatives by @prestwich in #603
- chore: release 1.20.0 by @prestwich in #620
New Contributors
Full Changelog: v1.19.0...v1.20.0
Release notes
Open source →Changed
- Open-code
PartialEqandis_zeroon riscv to avoidmemcmplibcalls (#604) - Run the core test suite on
wasm32-wasip1in CI to catch 32-bit pointer-width bugs (#609) - Make
reverse_bits,most_significant_bits,inv_ring,checked_pow,strict_pow,overflowing_pow,pow,saturating_pow,wrapping_pow,from_limbs_slice,checked_from_limbs_slice,wrapping_from_limbs_slice,overflowing_from_limbs_slice,saturating_from_limbs_slice,from_uint, andchecked_from_uintconst(#614)
Fixed
- Fix
overflowing_shl/overflowing_shroverflow-flag false negatives, which also corrected the dependentchecked_*/strict_*/saturating_*shifts andbyte()(#603) - Fix
from_str_radixrejecting the lowercase digitsg–zin radix 64 (#605) - Reject non-finite
f64inTryFrom<f64>and saturateUint→f64conversions at 2^1024 for largeBITS(#606) try_from_be_slice/try_from_le_slicenow returnNoneinstead of panicking forBITS % 64in57..=63(#607)from_str_radixandto_base_beno longer hang or silently accept radix/base 0 or 1 (#608)checked_log,checked_log2, andchecked_log10no longer panic for small bit-widths where the base constant does not fit the type (#610)- Fix incorrect doc comments and formulas in the
add,mul, andgcdalgorithms (#611) - Mark
addmul_nx1/submul_nx1unsafeand close soundness / safety-contract gaps in the unstablealgorithmsmodule (#612)
-
1.19.003 Jul 2026Release notes
Open source →What's Changed
- fix: resolve easy TODOs and doc issues by @DaniPopes in #571
- chore: remove clippy msrv by @DaniPopes in #573
- perf: optimize shift implementations by @DaniPopes in #574
- perf: optimize bit count helpers by @DaniPopes in #578
- Fix
to_be_byteson big-endian platforms by @kayabaNerve in #576 - chore: fix to_be_bytes by @DaniPopes in #580
- perf: compare using subtraction by @DaniPopes in #579
- feat: add ark-ff-06 by @Robert-MacWha in #584
- docs: update repository links by @DaniPopes in #586
- ci: make Accept gate fail when any required job fails by @prestwich in #585
- refactor: replace double word trait by @DaniPopes in #589
- refactor: add const range macro by @DaniPopes in #592
- feat: make mul fns const by @DaniPopes in #590
- feat: make from_str_radix const by @DaniPopes in #591
- chore(deps): bump actions/checkout from 5 to 7 by @dependabot[bot] in #596
- chore: ignore cargo-deny advisories by @DaniPopes in #598
- chore: clippy by @DaniPopes in #600
- fix(ci): harden issue tracker by @DaniPopes in #601
- chore(meta): update CODEOWNERS by @DaniPopes in #599
- feat: add strict_* operations by @0xMars42 in #595
- chore: group weekly GitHub Actions updates by @DaniPopes in #597
- chore: release 1.19.0 by @prestwich in #602
New Contributors
- @kayabaNerve made their first contribution in #576
- @Robert-MacWha made their first contribution in #584
- @0xMars42 made their first contribution in #595
Full Changelog: v1.18.0...v1.19.0
Release notes
Open source →Added
strict_*arithmetic operations (#595)ark-ff-06feature flag for conversion to[email protected]types (#584)
Changed
- Made
from_str_radixconst(#591) - Made multiplication functions
const(#590) - Optimize
Ord::cmpby comparing via subtraction (#579) - Optimize bit count helpers (leading/trailing zeros, count ones) (#578)
- Optimize shift implementations (#574)
Fixed
- Fix
to_be_byteson big-endian platforms (#576)
-
1.18.022 Apr 2026Release notes
Open source →What's Changed
- Use rkyv::primitive::ArchivedU64 by @DenisGorbachev in #556
- chore(deps): bump codspeed by @DaniPopes in #558
- perf: specialize cmp, const_eq, const_is_zero for small sizes by @DaniPopes in #561
- perf: optimize from_str_radix by @DaniPopes in #557
- perf: use bit shifts for power-of-two formatting by @DaniPopes in #565
- perf: extract last iteration on mul loop by @DaniPopes in #566
- docs: link to ruint-uniffi for FFI support by @paolodamico in #567
- perf: nudge LLVM codegen good to_bytes_be by @pepyakin in #569
- chore: bump MSRV to 1.90 by @DaniPopes in #570
- chore: release 1.18.0 by @DaniPopes in #572
New Contributors
- @DenisGorbachev made their first contribution in #556
- @paolodamico made their first contribution in #567
- @pepyakin made their first contribution in #569
Full Changelog: v1.17.2...v1.18.0
Release notes
Open source →Changed
- Optimize
from_str_radix(#557) - Specialize
Ord::cmp,const_eq,const_is_zerofor small sizes (#561) - Use bit shifts for power-of-two formatting (binary, octal, hex) instead of division (#565)
- Optimize
to_be_bytesfor full-limb sizes via per-limbswap_bytes(#569) - Extract last iteration on mul loop to reduce register pressure (#566)
Fixed
- Use
rkyv::primitive::ArchivedU64(#556)
-
1.17.228 Dec 2025Release notes
Open source →What's Changed
- fix(docsrs): remove doc_auto_cfg by @DaniPopes in #554
- chore: release 1.17.2 by @DaniPopes in #555
Full Changelog: v1.17.1...v1.17.2
-
1.17.126 Dec 2025Release notes
Open source →What's Changed
- Fix codspeed benches & add most_significant_bits bench by @Evalir in #544
- Fix codspeed benches & add most_significant_bits bench by @prestwich in #543
- chore: update unsafe function and improve documentation and safety notes by @Evalir in #553
- chore: update unsafe function and improve documentation and safety notes by @prestwich in #552
Full Changelog: v1.17.0...v1.17.1
Release notes
Open source →Changed
- Added
unsafeto many unstable API functions inalgorithmsmodule, and documented their conditions of use (COU). (#552)
-
1.17.024 Sep 2025Release notes
Open source →What's Changed
- chore: add parse benches by @DaniPopes in #518
- feat: bump MSRV to 1.85 by @DaniPopes in #503
- chore: use const block in add_mod by @DaniPopes in #521
- chore(deps): bump actions/checkout from 4 to 5 by @dependabot[bot] in #517
- feat: add support for ark-ff v0.5.0 by @fabian1409 in #526
- chore(deps): depend on
serde_coreinstead ofserdeby @DaniPopes in #527 - bench: bench from f64 and f32 by @Evalir in #531
- feat: make
*next*functions const by @DaniPopes in #533 - feat: add bincode 2 support by @lightsing in #516
- Enhanced f64 -> Uint conversion by @Pzixel in #524
- chore(deps): bump CodSpeedHQ/action from 3 to 4 by @dependabot[bot] in #528
- Add Uint -> f64/f32 benches by @Pzixel in #536
- Add Uint -> f64 conversion by @Pzixel in #535
- perf: use select_unpredictable by @DaniPopes in #537
- feat: switch to edition 2024 by @DaniPopes in #538
- chore: release 1.17.0 by @DaniPopes in #539
New Contributors
- @fabian1409 made their first contribution in #526
- @Pzixel made their first contribution in #524
Full Changelog: v1.16.0...v1.17.0
Release notes
Open source →Added
- Support for bincode 2 (#516)
- Introduce
ark-ff-05feature flag for conversion to[email protected]types (#526)
Changed
- MSRV bumped to 1.85 (#503)
- Made
*next_power_of_twoand*next_multiple_ofconst(#533) - Reimplemented
TryFrom<f64>forUintto speed it up, fixing edge cases and removingstdrequirements (#524) - Reimplemented
From<Uint>forf64andf32to speed it up, fixing edge cases and removingstdrequirements ([#535])
-
1.16.004 Aug 2025Release notes
Open source →What's Changed
- Add Codspeed workflow by @recmo in #468
- ci: update codspeed by @DaniPopes in #461
- benches: reduce codspeed flakiness by @DaniPopes in #470
- benches: batch codspeed routines manually by @DaniPopes in #471
- perf: clean up div, cmp by @DaniPopes in #464
- feat: add shift benchmarks by @Rjected in #473
- perf: make add_mod faster using overflow check by @DaniPopes in #469
- perf: improve conversion to primitive integers by @DaniPopes in #477
- fix: check limb overflow in shift ops by @DaniPopes in #476
- benches: fix shift bench names by @DaniPopes in #479
- fix: gt_u64_max by @DaniPopes in #480
- perf: improve, specialize leading_zeros by @DaniPopes in #485
- feat: support for
bigdecimalcrate by @klkvr in #486 - perf: roll mul_add_n by @DaniPopes in #492
- feat: implement PartialEq, PartialOrd for primitive integers by @DaniPopes in #491
- chore: add fmt benches by @DaniPopes in #487
- docs: update changelog for 491 by @DaniPopes in #493
- feat: add rkyv support by @lightsing in #483
- fix: rkyv tests with new inference by @Evalir in #495
- perf: improve u128 conversions by @DaniPopes in #496
- feat: remove "alloc" feature requirement from base_convert/fmt by @DaniPopes in #488
- perf: add a stack-allocated to_base_be by @DaniPopes in #490
- perf: special case small integers in fmt by @DaniPopes in #500
- perf: almost remove alloc from serde by @DaniPopes in #501
- perf: improve to_base_le by @DaniPopes in #497
- perf: implement write_char by @DaniPopes in #505
- chore: remove opt comment by @DaniPopes in #508
- perf: clean up algorithms::ops by @DaniPopes in #509
- docs: better document unstability of
mod algorithmsby @DaniPopes in #511 - perf: implement likely/unlikely using userland cold_path by @DaniPopes in #510
- perf: elide panics in algorithms by @DaniPopes in #512
- perf: inline div in Uint by @DaniPopes in #513
- chore: release 1.16.0 by @DaniPopes in #506
New Contributors
- @klkvr made their first contribution in #486
- @lightsing made their first contribution in #483
Full Changelog: v1.15.0...v1.16.0
Release notes
Open source →Added
- Support rkyv (#483)
- Added
bigdecimalsupport (#486) PartialEqandPartialOrdimplementations for primitive integers; minor breaking change for type inference (#491)
Changed
to_base_beandcore::fmttrait implementations are available without the "alloc" feature (#488)- Greatly improved performance across the board, mainly in: conversions, fmt, div/rem, mul, add_mod, leading_zeros
Fixed
- Check limb overflow in shift ops (#476)
-
1.15.022 May 2025Release notes
Open source →What's Changed
- dep: update pyo3 to 0.25 by @Evalir in #460
- chore: add .DS_Store to gitignore by @Rjected in #457
- ci: unpin clippy by @DaniPopes in #463
- chore: improve const-for usability by @DaniPopes in #465
- feat: constify bitwise and shift functions by @DaniPopes in #441
- bench: add cmp.rs benchmarks by @DaniPopes in #462
- chore: release 1.15.0 by @DaniPopes in #467
Full Changelog: v1.14.0...v1.15.0
-
1.14.025 Mar 2025Release notes
Open source →What's Changed
- chore: clippy by @DaniPopes in #437
- fix:
checked_bytebounds check and make it const by @DaniPopes in #438 - docs: update
try_from_{b,l}e_slicedocs by @DaniPopes in #439 - feat: Constify leading_zeros, leading_ones, count_ones, count_zeros, bit_len, byte_len, is_power_of_two by @kpp in #442
- ci: cache more jobs by @DaniPopes in #446
- chore(deps): update hex-literal requirement from 0.4 to 1.0 by @dependabot in #447
- fix(ci): ignore paste deny lint by @Evalir in #451
- feat: add
const ONEby @DaniPopes in #448 - feat: add
random,random_with,randomize,randomize_withmethods by @DaniPopes in #444 - feat: add support for rand 0.9 by @DaniPopes in #445
- fix: ub in rand by @DaniPopes in #453
- chore: release 1.14.0 by @DaniPopes in #454
New Contributors
Full Changelog: v1.13.1...v1.14.0
Release notes
Open source →Added
- Add const
notfunction (#442) - Make
leading_zeros,leading_ones,count_ones,count_zeros,bit_len,byte_len,is_power_of_twofunctionsconst(#442) random,random_with,randomize,randomize_withmethods (#444)- rand 0.9 support (#445)
- Add
const ONE(#448)
Changed
- Update
try_from_{b,l}e_slicedocumentation (#439)
Fixed
- Fix
checked_bytebounds check and make it const (#438)
-
1.13.118 Feb 2025Release notes
Open source →What's Changed
- fix: no_std build by removing unused dependency by @DaniPopes in #433
- chore: release 0.13.1 by @DaniPopes in #434
Full Changelog: v1.13.0...v1.13.1
-
1.13.018 Feb 2025Release notes
Open source →Added
- Support for borsh @ 1.5 (#416)
copy_le_to_slicefamily to allow easier writing to pre-allocated buffers (#424)- add
Uint::checked_byte(idx: usize) -> Option<u8>(#429)
Changed
- Unpin proptest (#426)
Fixed
-
1.12.416 Dec 2024Release notes
Open source →Added
- Added
Uint::square_redc. (#402) - Support for diesel @ 2.2 (#404)
- Support for sqlx @ 0.8 (#400)
- Support for fastrlp @ 0.4 (#401)
- Added support for
subtleandder(#399)
Removed
- Support for sqlx @ 0.7. This is a breaking change, outside of regular semver policy, as 0.7 contains a security vulnerability (#400)
Fixed
Uint::mul_redcis now alloc free (#402)
- Added
-
1.12.303 Jun 2024Release notes
Open source →Changed
- Use borrowing/carrying ops in add/sub, remove bound checks in shifts (#366)
- Make
mul_modnon-allocating (#373)
Fixed
- Add
allocrequirement tonum-traitsfeature #363
-
1.12.112 Mar 2024 -
1.12.027 Feb 2024Release notes
Open source →Added
- Wrap the
uint!macro to allow usage without needinguintimport (#350)
Fixed
- Overflow check in
overflowing_shrimplementation (#347)
- Wrap the
-
1.11.120 Nov 2023 -
1.11.031 Oct 2023Release notes
Open source →Added
bytemuckfeature (#292)Uint::is_zero() -> bool(#296)num-traitsfeatures (#298)U768alias (#310)- Improved
addandsubperformance (#316) - Made
addandsubfunctionsconst(#324) - Made
{from,to}_{b,l}e_bytesconst(#329)
Fixed
- Restricted RLP decoding to match the RLP spec and disallow leading zeros (#335)
leading_onesfailed for non-aligned sizes.
-
1.10.130 Jul 2023 -
1.10.030 Jul 2023 -
1.9.025 Jul 2023Release notes
Open source →Added
- Introduce
ark-ff-04feature flag for conversion to[email protected]types - Support for
alloy-rlp - MSRV (Minimum Supported Rust Version) is now set at 1.65.0, from previously undefined
- Implement
TryFrom<bool>forUint - New method:
byte
Changed
- Make
serde::Deserializeimpl more permissive - Use Ethereum
Quantityencoding for serde serialization when human-readable - Fix error in
from_base_bethat allowed instantiation of overflowingUint - Updated
fastrlpto0.3,pyo3to0.19, andsqlx-coreto0.7 - Improved
fastrlpperfomance - Improved
proptestperformance - Made
supportmodule and its modules public - Made more
algorithmfunctions public - Constified
as_le_sliceandas_le_bytes
Removed
- Automatic detection of nightly features. Enable them instead with the
nightlycargo feature - Dependency on
derive_more
Fixed
from_base_leimplementation by reversing the input iterator
- Introduce
-
1.8.019 Apr 2023Release notes
Open source →Added
- Support
bn-rs,serdeanduint!forBits
Fixed
- Serde human readable now encodes the empty bitstring as
0x0and rejects zero prefixes.
- Support
-
1.7.001 Nov 2022Release notes
Open source →Added
- Support
rlpforBits
Fixed
- Edge case in which an overflow occurs when parsing a
Uintwithuint!(#199).
- Support
-
1.6.029 Oct 2022Release notes
Open source →Added
TryFrom<Uint> for usize- Bit type aliases (
B128,B160,B256,B512, ...) FromandIntotrait implementations forprimitive-typesbit types- Support for
bn-rs - Derive
DefaultforBits
Changed
- (Breaking) Changed the arguments of
powandlogtoUint. - More efficient
wrapping_powimplementation.
-
1.5.125 Oct 2022 -
1.5.024 Oct 2022Release notes
Open source →Added
- Add
parity-scale-codecsupport. - Added unstable
algorithms::divmodule and improved div algorithm.
- Add
-
1.4.115 Oct 2022 -
1.4.003 Oct 2022Release notes
Open source →Added
- Add
Pyo3support. fromnow supportsUintarguments.saturating_from,wrapping_from,to,wrapping_to,saturating_to.wrapping_from_limbs_slice,overflowing_from_limbs_slice,saturating_from_limbs_slice.- Add
zeroizeandvaluablesupport.
Changed
ToUintErrorandFromUintErrornow contain wrapped value and other context.from_uintandchecked_from_uintare now deprecated.
- Add
-
1.3.009 Jun 2022Release notes
Open source →Added
- Added
inv_mod,mul_redc,gcd,gcd_extended,lcm. - Added
sqlxsupport.
Changed
- Renamed
ring_inversetoinv_ring.
- Added
-
1.2.004 Jun 2022Release notes
Open source →Added
- Added
reduce_mod,add_mod,mul_mod,pow_mod. - Added
num-bigintandark-ffsupport. - Made
algorithmspublic, but with unstable API for now.
Changed
- Marked
Uint::as_limbs_mutas unsafe. - Unified
mulimplementations and move toalgorithms.
Fixed
uint!macro incorrectly accepting hex digits in decimal.
- Added
-
1.1.031 May 2022Release notes
Open source →Added
- Added
saturating_shl. - Added
approx_log,approx_log2,approx_log10forf64log approximations. - Added
approx_pow2to construct fromf64log2 approximation. - Added
rootcomputing integer roots.
Changed
- Made logarithms
usizeto matchBITSinpow,logfunctions. - Applied
track_callerto div/rem ops to track div-by-zero easier.
- Added
-
1.0.028 May 2022Release notes
Open source →Added
- Added comparison.
- Added add, sub, neg and sum functions.
- Added mul functions.
- Added division and remainder functions.
- Added pow and log functions.
- Added
next_power_of_twoandnext_multiple_offunctions. - Added
checked_from_limb_sliceandfrom_uint.
Changed
from_limb_slicenow handles arbitrary length slices.
-
0.3.023 May 2022Release notes
Open source →Added
- All the binary operations (not, and, or, xor, shifts, rotate, etc)
Bits, a newtype wrappedUintrestricted to non-numeric operations.- Postgres
FromSqlsupport and JSON column support. from_base_leandfrom_base_bebase conversion.from_str_radixstring base conversion up to base64.FromStrtrait with decimal, hex, octal and binary support.
Changed
reverse_bitsis now by value instead of&mut self.
-
0.2.118 May 2022Release notes
Open source →Added
- Extensive Postgres ToSql support supporting many column types.
TryFrom<Uint>for primitive integer types.- Added
Fromconversions tof32andf64. - Implement all rust formatting:
Debug,Display, decimal, hex, etc. >>=operator.to_base_leandto_base_lebase conversion spigotsreverse_bits,most_sigificant_bitsbit methods.- Optimized
as_le_{slice,bytes)_*accessors.
Changed
- Rewrote
to_{be,le}_bytes_*to use optimized methods. This has trickle-down effects for a lot of conversions and formatting.
-
0.2.017 May 2022Release notes
Open source →Added
- Changelog
- CI test on stable Rust.
- Common bit-size aliases and nightly-only
Uint<BITS>alias. - Added
to_{be/le}_bytes_vecand madetry_from_le_byte_iterpublic. - Added
rlpandfastrlpsupport. - Added
into_limbs,leading_zeros,bit_len,byte_len,checked_log2. - Added
primitive-typessupport.
Changed
- Changed to
Uint<BITS, LIMBS>to get stable compatibility! - Added generic
BYTESparameter toto_{be/le}_bytes. - Renamed
try_from_{be/le}_slice.
-
0.1.015 May 2022Release notes
Open source →Added
- Const-generic
Uintstructure. - Basic
overflowing_addimplementation. - Algorithms for division and gcd (currently unused).
uint!andconst_for!macros.- Documentation with examples.
- Support for rand, arbitrary, quickcheck, proptest, serde
- Github actions for linting, testing, code coverage, cargo-audit.
- Pushed to crates.io.
<!-- links to version -->
- Const-generic