Expand description
Big-integer token used as the hash output and ring coordinate.
The C reference stores tokens as (signum, mag[4], len), where
mag[] holds little-significance-first 32-bit words in a numeral
system whose radix is UINT_MAX_PLUS_ONE (i.e. 2^32). Tokens are
signed so the comparator can distinguish negative values.
The Rust type DynToken preserves that representation exactly so
that cmp and the textual parser produce bit-identical answers.
§Examples
use dynomite::hashkit::DynToken;
let mut a = DynToken::default();
a.size(1).expect("len <= 4");
a.set_int(42);
assert_eq!(a.get_int(), 42);Structs§
- DynToken
- A signed magnitude integer used as both a hash output and a ring coordinate.
Enums§
- Sign
- Sign of a token.
Constants§
- TOKEN_
WORD_ CAPACITY - Maximum number of 32-bit words a token can hold.
Functions§
- parse_
token - Parse a textual token from
bytes. Accepts an optional leading-, then base-10 digits.