Uint64 class

Implemented types

Constructors

Uint64(int value)
Builds from a plain Dart int. Must be non-negative and representable exactly as a double (i.e. <= 2^53, which covers every case where the value didn't already come from hi/lo limbs). For values above 2^53 use fromBigInt or parseHex/parseDecimal.
factory
Uint64.from(int value)
Builds from a plain Dart int, accepting negative values by taking their two's-complement bit pattern (masked to 64 bits) instead of throwing like Uint64.new does — e.g. Uint64.from(-1) == Uint64.max. value must itself be a normal double-safe Dart int (|value| <= 2^53); mirrors the negation trick Int64.new already uses.
factory
Uint64.fromBigInt(BigInt value)
factory
Uint64.fromParts(int hi, int lo)
factory
Uint64.uncheckedU32(int n)
const
Uint64.unsafe(int _hi, int _lo)
const

Properties

hashCode → int
The hash code for this object.
no setteroverride
hi → int
no setter
isEven → bool
no setter
isOdd → bool
no setter
isZero → bool
no setter
lo → int
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addChecked(Uint64 other) → Uint64
Throws StateError instead of wrapping on overflow.
compareTo(Uint64 other) → int
Compares this object to another object.
override
mulChecked(Uint64 other) → Uint64
Throws StateError instead of wrapping on overflow.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
subChecked(Uint64 other) → Uint64
Throws StateError instead of wrapping on underflow.
toBigInt() → BigInt
toBytes([Endian endian = Endian.big]) → List<int>
Fixed 8-byte encoding, straight from the hi/lo limbs — no BigInt involved at any point.
toBytesBE() → List<int>
Deprecated aliases kept for call-site compatibility.
toBytesLE() → List<int>
toHexString({bool padded = true}) → String
toInt() → int
Only safe if the value fits in 53 bits (i.e. hi <= 0x1FFFFF). Throws otherwise — use toBigInt for the general case.
toInt128() → Int128
Zero-extending widen, then reinterpret — always non-negative and exact, since a 64-bit magnitude always fits in a positive Int128.
toInt32() → Int32
Truncating narrow, then reinterpret (wrapping, like a Rust as i32 cast).
toInt64() → Int64
Same-width bit reinterpretation (two's complement) — e.g. Uint64.max.toInt64() == Int64.minusOne.
toString() → String
A string representation of this object.
override
toUint128() → Uint128
Zero-extending widen. Always exact.
toUint256() → Uint256
Zero-extending widen. Always exact.
toUint32() → Uint32
Truncating narrow: keeps only the low 32 bits (wrapping, like a Rust as u32 cast).
toUint8() → int

Operators

operator %(Uint64 other) → Uint64
operator &(Uint64 other) → Uint64
operator *(Uint64 other) → Uint64
operator +(Uint64 other) → Uint64
operator -(Uint64 other) → Uint64
operator <(Uint64 other) → bool
operator <<(int n) → Uint64
Logical (unsigned) left shift. There's no arithmetic-shift distinction for an unsigned type.
operator <=(Uint64 other) → bool
operator ==(Object other) → bool
The equality operator.
override
operator >(Uint64 other) → bool
operator >=(Uint64 other) → bool
operator >>(int n) → Uint64
Logical (unsigned) right shift.
operator ^(Uint64 other) → Uint64
operator unary-() → Uint64
operator |(Uint64 other) → Uint64
operator ~() → Uint64
operator ~/(Uint64 other) → Uint64

Static Methods

adc(Uint64 a, Uint64 b, Uint64 carry) → (Uint64, Uint64)
Add-with-carry: a + b + carry. Returns (result, carryOut) where carryOut is the numeric carry (0, 1, or 2 — matches Rust's adc, which accepts a full-width carry-in from a preceding mac).
ctEquals(List<Uint64> a, List<Uint64> b) → bool
XOR-accumulate equality check across two same-length limb lists — avoids short-circuiting on the first differing limb, matching the intent of typical constant-time field-element comparisons.
ctSelect(Uint64 a, Uint64 b, bool choice) → Uint64
Branchless select: returns b if choice else a. Built from a bitmask blend, matching the shape of typical constant-time field code (this is a helper, not a hardened constant-time guarantee — Dart's runtime doesn't guarantee branchless codegen).
fromBytes(List<int> bytes, {int offset = 0, Endian endian = Endian.big}) → Uint64
Parses an 8-byte unsigned integer directly into hi/lo limbs without using BigInt.
fromBytesBE(List<int> b) → Uint64
fromBytesLE(List<int> b) → Uint64
mac(Uint64 a, Uint64 b, Uint64 c, Uint64 carry) → (Uint64, Uint64)
Multiply-accumulate: a + b*c + carry as a full 128-bit value. Returns (result, carryOut) — the standard building block of Comba multiplication / Montgomery reduction inner loops.
parseDecimal(String s) → Uint64
Strict decimal parse: throws IntegerError on overflow, unlike the wrapping */+ operators.
parseHex(String s) → Uint64
sbb(Uint64 a, Uint64 b, Uint64 borrowIn) → (Uint64, Uint64)
Subtract-with-borrow: a - b - borrowBit, where the borrow bit is derived from borrowIn (zero = no borrow; any nonzero = borrow — matches the all-ones-mask convention constant-time field code uses). Returns (result, borrowOutMask), where borrowOutMask is Uint64.zero or Uint64.max — ready to & directly against a modulus limb for a conditional add-back.
widenMul(Uint64 a, Uint64 b) → (Uint64, Uint64)
Full 128-bit product of a * b, returned as (high, low) Uint64.
widenMulPortable(Uint64 a, Uint64 b) → (Uint64, Uint64)
Full 128-bit product of a * b, returned as (high, low) Uint64.

Constants

mask8 → const Uint64
max → const Uint64
maxInt → const Uint64
maxU32 → const Uint64
one → const Uint64
two → const Uint64
zero → const Uint64