Releases: isaacholt100/bnum
v0.12.1
This release fixes a few incorrect implementations of some methods.
Patches
- Fixed #47, by making
midpoint
round to zero for signed integers. - Changed the
Debug
implementation ofParseIntError
to match that ofcore::num::ParseIntError
. - Fixed the
lcm
method onnum-integer::Integer
for signed integers (now always returns non-negative values) - Corrected more cases where a
PosOverflow
error is returned instead of anInvalidDigit
error when parsing integers (however there some edge cases wherePosOverflow
should be returned and now isn't, this will be fixed at some point).
Auto-generated release notes:
What's Changed
- Latest by @isaacholt100 in #48
Full Changelog: v0.12.0...v0.12.1
v0.12.0
This release introduces a number of new methods, as well as support for the borsh
crate.
Major Changes
- The latest nightly compiler (
1.83.0
) does not support user-definedconst
traits, and so thenightly
crate feature no longer makes theCastFrom
andAs
traitsconst
. This means the implementations of these traits on bnum integers are no longerconst
either.
Minor Changes
- Added (optional) support for the
borsh
crate (this enables serialisation and deserialisation using this crate). - Added
digits_mut
andset_bit
methods to unsigned integers, allowing for manipulation without copying the value. - Added
cast_signed
method for unsigned integers andcast_unsigned
method for signed integers. - Added
midpoint
method for all integers. - Added
carrying_add
andborrowing_sub
methods for signed integers. - Added
strict_...
arithmetic methods for all integers.
Patches
- Added
(bnum)
prefix to panic messages that mistakenly did not include it.
Auto-generated release notes:
What's Changed
- feat(serde): borsh by @dzmitry-lahoda in #42
- add digits_mut to buint by @krakow10 in #45
- add set_bit to buint by @krakow10 in #44
- Latest by @isaacholt100 in #46
New Contributors
- @dzmitry-lahoda made their first contribution in #42
- @krakow10 made their first contribution in #45
Full Changelog: v0.11.0...v0.12.0
v0.11.0
This release fixes #39, and makes all ilog*
methods panic with the same message as Rust's primitive integers (with the (bnum)
prefix, as for other bnum panic messages).
Major Changes
ilog*
methods now panic for invalid inputs in release mode as well as debug mode.
Patches
ilog*
panic messages now match that of Rust's primitives.
What's Changed
- Latest by @isaacholt100 in #40
Full Changelog: v0.10.0...v0.11.0
v0.8.1
v0.10.0
This release fixes #36, which was related to a premature stabilisation of the language feature const_intrinsic_copy
(see rust-lang/rust#117905). Previously, several functions had relied on this feature, which meant their implementations contained Undefined Behaviour. (For a list of those affected and for further details, see changes/prior-bugs.md
). Completely safe implementations have now been written for these functions.
This is marked as a major change as previous versions v0.7.0
- v0.9.1
may at some point cease to be compatible with the latest version of the Rust compiler, if stabilisation of const_intrinsic_copy
is reverted.
What's Changed
- v0.10.0 by @isaacholt100 in #38
Full Changelog: v0.9.1...v0.10.0
v0.9.1
Patches
The only change in this version is the addition of the rust-version
(MSRV) field to Cargo.toml
. The MSRV is currently 1.65.0
.
What's Changed
- Add minimum rust version by @chipshort in #34
- v0.9.1 by @isaacholt100 in #35
New Contributors
- @chipshort made their first contribution in #34
Full Changelog: v0.9.0...v0.9.1
v0.9.0
Changes in v0.9.0
Major Changes
bnum
integers are now#[repr(transparent)]
, which solves #30.- The
Slice
struct is now#[repr(transparent)]
. - The bnum
wrapping_rem
method now has the same panic message aswrapping_rem
on primitive integers. unchecked_shl
andunchecked_shr
now take au32
as the shifting argument instead ofSelf
.- The implementations of
unchecked_shl
andunchecked_shr
forbnum
integers with64
-bit digits were previously incorrect; they have now been fixed. - The implementation of
Add<$Digit>
on allbnum
unsigned integers was previously incorrect; it has now been fixed. - The
lcm
method onbnum
integers no longer panics ifself
is zero; instead, it returns zero.
Minor Changes
- Added optional
zeroize
support. - Added optional
quickcheck
support. - Added optional
valuable
support. - Change from manual implementation of
PartialEq
andEq
to#[derive(PartialEq, Eq)]
: this fixes #32. - Added trait
BTryFrom
for fallible conversions between bnum integers - this is a temporary solution to #31. - Don't require the
std_rng
andsmall_rng
features of therand
crate except when testing.
Patches
- Improved performance for all
shr
methods (checked_shr
,wrapping_shr
, etc.).
Auto release notes
- v0.9.0 by @isaacholt100 in #33
Full Changelog: v0.8.0...v0.9.0
v0.8.0
Breaking Changes
There are no breaking changes in this release.
Other Changes
- The following methods on all unsigned and signed integers are now
const
on stable:checked_div
,checked_div_euclid
,checked_rem
,checked_rem_euclid
,checked_next_multiple_of
,checked_ilog10
,checked_ilog
,div
,rem
,overflowing_div
,overflowing_div_euclid
,overflowing_rem
,overflowing_rem_euclid
,saturating_div
,wrapping_div
,wrapping_div_euclid
,wrapping_rem
,wrapping_rem_euclid
,div_euclid
,rem_euclid
,ilog10
,ilog
,next_multiple_of
,div_floor
,div_ceil
. - It is now possible to cast between bnum integers of different digit sizes: for example, you can cast to and from
BUint<5>
toBIntD16<7>
. - Issue #25 has been fixed, which means that all formatting trait implementations should now match those for primitive integers (in previous versions, some formatting traits ignored formatting options such as zero padding).
What's Changed
- v0.8.0 by @isaacholt100 in #28
- Fix error in publish.yml by @isaacholt100 in #29
Full Changelog: v0.7.0...v0.8.0
v0.7.0
Breaking changes
- Unfortunately version
1.71.0
of the nightly Rust compiler dropped support of theconst
implementation of common standard library traits. Previous to this version,bnum
hadconst
implementations of many standard library traits such asAdd
,BitOr
,PartialEq
, etc. which were available using nightly. However, now this is no longer possible with the current version of the nightly Rust compiler (as of 28th May 2023), hence theconst
implementations of these traits have been dropped for now to allow compatibility with the latest version on nightly. To account for this, many of the methods defined on these traits now haveconst
implementations on the integer types themselves - so for example, there are nowBUint::shr
andBInt::shr
methods which areconst
.
Other changes
- The (non-default)
arbitrary
feature has been introduced, which derives theArbitrary
trait from thearbitrary
crate. Note that normallybnum
works withno_std
, but it cannot with this feature enabled. - The following methods are now
const
on stable:abs_diff
,<uint>::{overflowing_neg, wrapping_neg}
,wrapping_{shr, shl}
,overflowing_{shr, shl}
,checked_{shr, shl}
,rotate_left
,rotate_right
,from_be_slice
,from_le_slice
.
(@lrubasze contributed the addition of the arbitrary
support in this release - due to a complication with the CI with his pull request, I'm mentioning him here so he is included in this list of contributors).
What's Changed
- Add support for const-trait methods defined on the types themselves by @isaacholt100 in #21
- Bump version to 0.7.0 by @isaacholt100 in #24
Full Changelog: v0.6.0...v0.7.0
v0.6.0
There were no breaking changes in this release. The biggest update is the introduction of the const parse_str_radix
method on signed and unsigned integers, which allows compile-time parsing of string literals in a given radix. from_str_radix
is now also const, which allows compile-time parsing of string literals which are not guaranteed to parse successfully.
The following methods are now const
on stable:
{BUint, BInt}::parse_bytes
BInt::overflowing_mul
BInt::overflowing_neg
BInt::overflowing_abs
BInt::overflowing_pow
BInt::wrapping_neg
BInt::wrapping_abs
BInt::checked_mul
BInt::checked_neg
BInt::checked_abs
BInt::checked_pow
BInt::saturating_mul
BInt::saturating_neg
BInt::saturating_abs
BInt::saturating_pow
BInt::unsigned_abs
BInt::pow
BInt::abs
BInt::abs_diff
Additionally, the following methods are now const
when the nightly
feature is enabled:
{BUint, BInt}::from_radix_be
{BUint, BInt}::from_radix_le
What's Changed
- v0.6.0 by @isaacholt100 in #19
Full Changelog: v0.5.0...v0.6.0