Bot releases are visible (Hide)
This release fixes one bug in the DivMod
method, which under certain types of aliased inputs would produce faulty output. It also adds a method IntoBig
for alloc-free conversion into big.Int
.
Full Changelog: https://github.com/holiman/uint256/compare/v1.3.0...v1.3.1
Nathaniel Martin is a character from Patrick O'Brian's Aubrey/Maturin - books, set in the 1800s, the age of fighting sail. Nathaniel Martin is a natural philosopher and is a kind of sidekick to Stephen Maturin.
Published by holiman 3 months ago
The 1.3.0-release contains a lot of optimizations, contributed by @AaronChen0. Thanks for all the contributions! Other than that, a breaking change in the ssz-interface implementation and a bugfix.
optimizations to Mul
, squared
, Exp
, Set
, DivMod
, Byte
, Lsh
, Rsh
, SRsh
, ExtendSign
, AddMod
, MulOverflow
, MulMod
, MulDivOverflow
, MulModWithReciprocal
, Mod
, Sqrt
by @AaronChen0 in (https://github.com/holiman/uint256/pull/152, https://github.com/holiman/uint256/pull/153, https://github.com/holiman/uint256/pull/154, https://github.com/holiman/uint256/pull/158, https://github.com/holiman/uint256/pull/165, https://github.com/holiman/uint256/pull/166, https://github.com/holiman/uint256/pull/167, https://github.com/holiman/uint256/pull/168, https://github.com/holiman/uint256/pull/169, https://github.com/holiman/uint256/pull/172, https://github.com/holiman/uint256/pull/173, https://github.com/holiman/uint256/pull/174
Fixes a bug in SetBytes29
(https://github.com/holiman/uint256/pull/157)
Test-improvements, now using golang-native fuzzing instead of gofuzz-based fuzzing by @holiman (https://github.com/holiman/uint256/pull/163, https://github.com/holiman/uint256/pull/164)
The method MarshalSSZTo
was removed, and has been replaced by MarshalSSZAppend
and MarshalSSZInto
. This is an intentionally breaking change, forcing users to explicitly choose which implementation they desire. For more info, see https://github.com/holiman/uint256/pull/171
Full Changelog: https://github.com/holiman/uint256/compare/v1.2.4...v1.2.5
The uint256
release naming-convention is "fictional mathematicians", later expanded into "fictional scientists", due to the dearth of fiction about mathematicians.
Fitcher Penrose appears in Amitav Ghosh's Ibis-trilogy, part II, "River of Smoke". He is a botanist collecting rare plants in Asia.
Published by holiman 11 months ago
Log10()
by @fyfyrchik in https://github.com/holiman/uint256/pull/141
String
, MarshalText
and MarshalJSON
by @holiman in https://github.com/holiman/uint256/pull/144
OBS! #144 is a bit of a breaking change, in some situations, since it changes the output-formats when converting to string, in order to better mirror big.Int
behaviour. Please read the PR-description to understand the effects of the change.
Full Changelog: https://github.com/holiman/uint256/compare/v1.2.3...v1.2.4
Published by holiman over 1 year ago
Float64() float64
by @holiman in https://github.com/holiman/uint256/pull/132
CmpBig
by @holiman in https://github.com/holiman/uint256/pull/138
Log10
and CmpUint64
by @holiman in https://github.com/holiman/uint256/pull/136
nil
big.Int
and nil
uint256.Int
by @karalabe in https://github.com/holiman/uint256/pull/137
// Float64 returns the float64 value nearest to x.
//
// Note: The `big.Float` version of `Float64` also returns an 'Accuracy', indicating
// whether the value was too small or too large to be represented by a
// `float64`. However, the `uint256` type is unable to represent values
// out of scope (|x| < math.SmallestNonzeroFloat64 or |x| > math.MaxFloat64),
// therefore this method does not return any accuracy.
func (z *Int) Float64() float64
// CmpBig compares z and x and returns:
//
// -1 if z < x
// 0 if z == x
// +1 if z > x
func (z *Int) CmpBig(x *big.Int) (r int)
// CmpUint64 compares z and x and returns:
//
// -1 if z < x
// 0 if z == x
// +1 if z > x
func (z *Int) CmpUint64(x uint64) int
// Log10 returns the log in base 10, floored to nearest integer.
// **OBS** This method returns '0' for '0', not `-Inf`.
func (z *Int) Log10() uint
Full Changelog: https://github.com/holiman/uint256/compare/v1.2.2...v1.2.3
Published by holiman over 1 year ago
fastssz
by @karalabe in https://github.com/holiman/uint256/pull/126
MustFromBig
, MustFromHex
and MustFromDecimal
by @karalabe and @holiman in https://github.com/holiman/uint256/pull/128, https://github.com/holiman/uint256/pull/131
PrettyDec
and native Dec
by @holiman in https://github.com/holiman/uint256/pull/130
AddMod
by @jwasinger in https://github.com/holiman/uint256/pull/120
Int
s// FromDecimal is a convenience-constructor to create an Int from a
// decimal (base 10) string. Numbers larger than 256 bits are not accepted.
func FromDecimal(decimal string) (*Int, error)
// MustFromBig is a convenience-constructor from big.Int.
// Returns a new Int and panics if overflow occurred.
func MustFromBig(b *big.Int) *Int
// MustFromHex is a convenience-constructor to create an Int from
// a hexadecimal string.
// Returns a new Int and panics if any error occurred.
func MustFromHex(hex string) *Int
// MustFromDecimal is a convenience-constructor to create an Int from a
// decimal (base 10) string.
// Returns a new Int and panics if any error occurred.
func MustFromDecimal(decimal string) *Int
Int
instances// SetFromDecimal sets z from the given string, interpreted as a decimal number.
// OBS! This method is _not_ strictly identical to the (*big.Int).SetString(..., 10) method.
// Notable differences:
// - This method does not accept underscore input, e.g. "100_000",
// - This method does not accept negative zero as valid, e.g "-0",
// - (this method does not accept any negative input as valid))
func (z *Int) SetFromDecimal(s string) (err error)
// SetFromHex sets z from the given string, interpreted as a hexadecimal number.
// OBS! This method is _not_ strictly identical to the (*big.Int).SetString(..., 16) method.
// Notable differences:
// - This method _require_ "0x" or "0X" prefix.
// - This method does not accept zero-prefixed hex, e.g. "0x0001"
// - This method does not accept underscore input, e.g. "100_000",
// - This method does not accept negative zero as valid, e.g "-0x0",
// - (this method does not accept any negative input as valid)
func (z *Int) SetFromHex(hex string) error
// Scan implements the database/sql Scanner interface.
// It decodes a string, because that is what postgres uses for its numeric type
func (dst *Int) Scan(src interface{}) error
// MarshalJSON implements json.Marshaler.
func (z *Int) MarshalJSON() ([]byte, error)
// Value implements the database/sql/driver Valuer interface.
func (src *Int) Value() (driver.Value, error)
// Dec returns the decimal representation of z.
func (z *Int) Dec() string
// PrettyDec returns the decimal representation of z, with thousands-separators.
func (z *Int) PrettyDec(separator byte) string
ssz
encoding// MarshalSSZTo implements the fastssz.Marshaler interface and serializes the
// integer into an already pre-allocated buffer.
func (z *Int) MarshalSSZTo(dst []byte) ([]byte, error)
// MarshalSSZ implements the fastssz.Marshaler interface and returns the integer
// marshalled into a newly allocated byte slice.
func (z *Int) MarshalSSZ() ([]byte, error)
// SizeSSZ implements the fastssz.Marshaler interface and returns the byte size
// of the 256 bit int.
func (*Int) SizeSSZ() int
// UnmarshalSSZ implements the fastssz.Unmarshaler interface and parses an encoded
// integer into the local struct.
func (z *Int) UnmarshalSSZ(buf []byte) error
// HashTreeRoot implements the fastssz.HashRoot interface's non-dependent part.
func (z *Int) HashTreeRoot() ([32]byte, error)
Full Changelog: https://github.com/holiman/uint256/compare/v1.2.1...v1.2.2
Published by holiman about 2 years ago
The v1.2.1
release, "Hari Seldon", contains some new API-methods and a lot of improvements under the hood and in the surrounding infrastructure.
uint256
library is now continuously fuzzed by the fine folks at OSS-Fuzz.DivMod()
(#113)MulDivOverflow()
(#110)Sqrt()
(#104)Cmp()
(#85)Thanks to all contributors to this release: @holiman, @chfast,@daosvik, @Planxnx and @fyrchik.
Published by holiman over 3 years ago
The 1.2.0
release, "Enoch Root", contains an important fix to SubUint64
, which was flaweed (see https://github.com/holiman/uint256/pull/82 ).
Other than that some API methods have been changed, to make uint256.Int
closer resemble big.Int
, to be easier to use as a drop-in replacement (also https://github.com/holiman/uint256/pull/82 ).
Published by holiman about 4 years ago
This release adds various methods for marshalling from text/json, to make integration with go-ethereum easier
Published by holiman over 4 years ago
The 1.1.0
release of uint256
contains some improvements and new features.
MulOverflow
was added (https://github.com/holiman/uint256/pull/75 and https://github.com/holiman/uint256/pull/76)EncodeRLP
method was added (https://github.com/holiman/uint256/pull/74)SetBytes
-method was improved by an order of magnitude, and the extremely fast specialized methods SetBytes1
, SetBytes2
etc were added (https://github.com/holiman/uint256/pull/70).Published by holiman over 4 years ago
This is the first official production release of uint256
.
Most of the really great changes recently are due to @chfast, who has done tremendous work on:
And last but not least, further improve speeds everywhere.
Release-names are mathematicians in fiction