mirror of
https://github.com/logos-storage/constantine.git
synced 2026-01-03 05:33:07 +00:00
19 lines
362 B
Nim
19 lines
362 B
Nim
|
|
# From issue #241
|
||
|
|
|
||
|
|
import
|
||
|
|
../../constantine/math/[
|
||
|
|
arithmetic,
|
||
|
|
io/io_bigints]
|
||
|
|
|
||
|
|
let a = BigInt[64].fromUint(0xa0e5cb56a1c08396'u64)
|
||
|
|
let M = BigInt[64].fromUint(0xae57180eceb0206f'u64)
|
||
|
|
|
||
|
|
var r: BigInt[64]
|
||
|
|
|
||
|
|
r.reduce(a, M)
|
||
|
|
|
||
|
|
let rU64 = 0xa0e5cb56a1c08396'u64 mod 0xae57180eceb0206f'u64
|
||
|
|
echo r.toHex()
|
||
|
|
|
||
|
|
doAssert rU64 == a.limbs[0].uint64
|
||
|
|
doAssert bool(a == r)
|