mirror of
https://github.com/codex-storage/constantine.git
synced 2025-02-04 15:03:36 +00:00
fix bigint mul non-compilation after #231
This commit is contained in:
parent
d69c7bf8e9
commit
cb038bb515
@ -302,7 +302,7 @@ const testDesc: seq[tuple[path: string, useGMP: bool]] = @[
|
||||
("tests/math_bigints/t_io_bigints.nim", false),
|
||||
# ("tests/math_bigints/t_bigints.nim", false),
|
||||
# ("tests/math_bigints/t_bigints_multimod.nim", false),
|
||||
# ("tests/math_bigints/t_bigints_mul_vs_gmp.nim", true),
|
||||
("tests/math_bigints/t_bigints_mul_vs_gmp.nim", true),
|
||||
# ("tests/math_bigints/t_bigints_mul_high_words_vs_gmp.nim", true),
|
||||
|
||||
# Big ints - arbitrary precision
|
||||
|
@ -39,7 +39,7 @@ macro mul_gen[rLen, aLen, bLen: static int](r_PIR: var Limbs[rLen], a_MEM: Limbs
|
||||
let
|
||||
r = asmArray(r_PIR, rLen, PointerInReg, asmInputOutputEarlyClobber, memIndirect = memWrite) # MemOffsettable is the better constraint but compilers say it is impossible. Use early clobber to ensure it is not affected by constant propagation at slight pessimization (reloading it).
|
||||
a = asmArray(a_MEM, aLen, MemOffsettable, asmInput)
|
||||
b = asmArray(b_MEM, aLen, MemOffsettable, asmInput)
|
||||
b = asmArray(b_MEM, bLen, MemOffsettable, asmInput)
|
||||
|
||||
tSym = ident"t"
|
||||
t = asmValue(tSym, Reg, asmOutputEarlyClobber)
|
||||
|
@ -63,6 +63,10 @@ proc main() =
|
||||
mpz_init(r)
|
||||
mpz_init(a)
|
||||
mpz_init(b)
|
||||
defer:
|
||||
mpz_clear(b)
|
||||
mpz_clear(a)
|
||||
mpz_clear(r)
|
||||
|
||||
testRandomModSizes(12, rBits, aBits, bBits, wordsStartIndex):
|
||||
# echo "--------------------------------------------------------------------------------"
|
||||
|
@ -16,6 +16,7 @@ import
|
||||
../../constantine/math/arithmetic,
|
||||
../../constantine/platforms/abstractions,
|
||||
# Test utilities
|
||||
../../constantine/platforms/codecs,
|
||||
../../helpers/prng_unsafe
|
||||
|
||||
echo "\n------------------------------------------------------\n"
|
||||
@ -60,6 +61,10 @@ proc main() =
|
||||
mpz_init(r)
|
||||
mpz_init(a)
|
||||
mpz_init(b)
|
||||
defer:
|
||||
mpz_clear(b)
|
||||
mpz_clear(a)
|
||||
mpz_clear(r)
|
||||
|
||||
testRandomModSizes(12, rBits, aBits, bBits):
|
||||
# echo "--------------------------------------------------------------------------------"
|
||||
@ -117,8 +122,8 @@ proc main() =
|
||||
discard mpz_export(aBuf[0].addr, aW.addr, GMP_MostSignificantWordFirst, 1, GMP_WordNativeEndian, 0, a)
|
||||
discard mpz_export(bBuf[0].addr, bW.addr, GMP_MostSignificantWordFirst, 1, GMP_WordNativeEndian, 0, b)
|
||||
"\nMultiplication with operands\n" &
|
||||
" a (" & align($aBits, 4) & "-bit): " & aBuf.toHex & "\n" &
|
||||
" b (" & align($bBits, 4) & "-bit): " & bBuf.toHex & "\n" &
|
||||
" a (" & align($aBits, 4) & "-bit): " & aBuf.toHex() & "\n" &
|
||||
" b (" & align($bBits, 4) & "-bit): " & bBuf.toHex() & "\n" &
|
||||
"into r of size " & align($rBits, 4) & "-bit failed:" & "\n" &
|
||||
" GMP: " & rGMP.toHex() & "\n" &
|
||||
" Constantine: " & rConstantine.toHex() & "\n" &
|
||||
|
Loading…
x
Reference in New Issue
Block a user