Documentation
¶
Index ¶
- Constants
- Variables
- func QuoRem256By128(u Uint128, carry Uint128, v Uint128) (Uint128, Uint128, errors.Error)
- type Uint128
- func FromBigInt(i *big.Int) (Uint128, errors.Error)
- func FromBytes(bs [16]byte) Uint128
- func FromBytesBigEndian(b [16]byte) Uint128
- func FromString(s string) (Uint128, errors.Error)
- func FromUint64(u uint64) Uint128
- func QuoRem192By64(u Uint128, carry uint64, v uint64) (Uint128, uint64, errors.Error)
- func SubUnsafe(u Uint128, v Uint128) Uint128
- func (self Uint128) Add(other Uint128) (Uint128, errors.Error)
- func (self Uint128) Add64(other uint64) (Uint128, errors.Error)
- func (self Uint128) And(other Uint128) Uint128
- func (self Uint128) And64(other uint64) Uint128
- func (self Uint128) AppendBytes(bs []byte) []byte
- func (self Uint128) AppendBytesBigEndian(bs []byte) []byte
- func (self Uint128) BigInt() *big.Int
- func (self Uint128) BitLen() int
- func (self Uint128) Bytes() [16]byte
- func (self Uint128) BytesBigEndian() [16]byte
- func (self Uint128) Compare(other Uint128) int
- func (self Uint128) Div(other Uint128) (Uint128, errors.Error)
- func (self Uint128) Div64(other uint64) (Uint128, errors.Error)
- func (self Uint128) Equal(other Uint128) bool
- func (self Uint128) IsZero() bool
- func (self Uint128) LeadingZeroBitsCount() int
- func (self Uint128) Lsh(n uint) Uint128
- func (self Uint128) MarshalText() ([]byte, error)
- func (self Uint128) Mod(other Uint128) (Uint128, errors.Error)
- func (self Uint128) Mod64(other uint64) (uint64, errors.Error)
- func (self Uint128) Mul(other Uint128) (Uint128, errors.Error)
- func (self Uint128) Mul64(other uint64) (Uint128, errors.Error)
- func (self Uint128) MulCarry(other Uint128) (Uint128, Uint128)
- func (self Uint128) NonZeroBitsCount() int
- func (self Uint128) Or(other Uint128) Uint128
- func (self Uint128) Or64(other uint64) Uint128
- func (self Uint128) PutBytes(bs []byte) errors.Error
- func (self Uint128) PutBytesBigEndian(bs []byte) errors.Error
- func (self Uint128) QuoRem(other Uint128) (Uint128, Uint128, errors.Error)
- func (self Uint128) QuoRem64(other uint64) (Uint128, uint64, errors.Error)
- func (self Uint128) ReverseBits() Uint128
- func (self Uint128) ReverseBytes() Uint128
- func (self Uint128) RotateBitsLeft(k int) Uint128
- func (self Uint128) RotateBitsRight(k int) Uint128
- func (self Uint128) Rsh(n uint) Uint128
- func (self *Uint128) Scan(s fmt.ScanState, ch rune) error
- func (self Uint128) String() string
- func (self Uint128) StringToBuf(buf []byte) int
- func (self Uint128) Sub(other Uint128) (Uint128, errors.Error)
- func (self Uint128) Sub64(other uint64) (Uint128, errors.Error)
- func (self Uint128) TrailingZeroBitsCount() int
- func (self Uint128) Uint64() (uint64, errors.Error)
- func (self *Uint128) UnmarshalText(b []byte) error
- func (self Uint128) Xor(other Uint128) Uint128
- func (self Uint128) Xor64(other uint64) Uint128
Constants ¶
View Source
const ( MaxUint64Str = "18446744073709551615" MaxUint128Str = "340282366920938463463374607431768211455" MaxStrLen = 39 // maximum number of digits in a 128-bit unsigned integer MaxStrLen64 = 20 // maximum number of digits in a 64-bit unsigned integer MaxSafeStrLen64 = 19 // maximum number of digits that can be safely parsed as a 64-bit unsigned integer ZeroStr = "0" )
Variables ¶
View Source
var ( Zero = Uint128{} Max = Uint128{math.MaxUint64, math.MaxUint64} Max64 = Uint128{math.MaxUint64, 0} Pow10Uint64 = [...]uint64{ 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000, 100000000000, 1000000000000, 10000000000000, 100000000000000, 1000000000000000, 10000000000000000, 100000000000000000, 1000000000000000000, 10000000000000000000, } Pow10Uint128 = [...]Uint128{ {Lo: 1}, {Lo: 10}, {Lo: 100}, {Lo: 1000}, {Lo: 10000}, {Lo: 100000}, {Lo: 1000000}, {Lo: 10000000}, {Lo: 100000000}, {Lo: 1000000000}, {Lo: 10000000000}, {Lo: 100000000000}, {Lo: 1000000000000}, {Lo: 10000000000000}, {Lo: 100000000000000}, {Lo: 1000000000000000}, {Lo: 10000000000000000}, {Lo: 100000000000000000}, {Lo: 1000000000000000000}, {Lo: 10000000000000000000}, {Lo: 7766279631452241920, Hi: 5}, {Lo: 3875820019684212736, Hi: 54}, {Lo: 1864712049423024128, Hi: 542}, {Lo: 200376420520689664, Hi: 5421}, {Lo: 2003764205206896640, Hi: 54210}, {Lo: 1590897978359414784, Hi: 542101}, {Lo: 15908979783594147840, Hi: 5421010}, {Lo: 11515845246265065472, Hi: 54210108}, {Lo: 4477988020393345024, Hi: 542101086}, {Lo: 7886392056514347008, Hi: 5421010862}, {Lo: 5076944270305263616, Hi: 54210108624}, {Lo: 13875954555633532928, Hi: 542101086242}, {Lo: 9632337040368467968, Hi: 5421010862427}, {Lo: 4089650035136921600, Hi: 54210108624275}, {Lo: 4003012203950112768, Hi: 542101086242752}, {Lo: 3136633892082024448, Hi: 5421010862427522}, {Lo: 12919594847110692864, Hi: 54210108624275221}, {Lo: 68739955140067328, Hi: 542101086242752217}, {Lo: 687399551400673280, Hi: 5421010862427522170}, } )
Functions ¶
Types ¶
type Uint128 ¶
func FromBytesBigEndian ¶
func FromUint64 ¶
func QuoRem192By64 ¶
QuoRem192By64 return q, r which: q must be a u128 u = q*v + r Returns error if u.carry >= v, because the result can't fit into u128
func SubUnsafe ¶
SubUnsafe returns u - v with u >= v must be called only when u >= v or the result will be incorrect
func (Uint128) AppendBytes ¶
func (Uint128) AppendBytesBigEndian ¶
func (Uint128) BytesBigEndian ¶
func (Uint128) LeadingZeroBitsCount ¶
func (Uint128) MarshalText ¶
func (Uint128) NonZeroBitsCount ¶
func (Uint128) ReverseBits ¶
func (Uint128) ReverseBytes ¶
func (Uint128) RotateBitsLeft ¶
func (Uint128) RotateBitsRight ¶
func (Uint128) StringToBuf ¶
func (Uint128) TrailingZeroBitsCount ¶
func (*Uint128) UnmarshalText ¶
Click to show internal directories.
Click to hide internal directories.