File tree Expand file tree Collapse file tree
constantine/math_compiler/experimental Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,9 +22,19 @@ macro asm_comment*(msg: typed): untyped =
2222
2323template bigintToUint32Limbs * (b: typed ): untyped =
2424 let limbs = b.limbs
25- var res = default (array [b.limbs.len, uint32 ])
26- for i in 0 ..< limbs.len:
27- res[i] = limbs[i].uint32
25+ when CTT_32 :
26+ var res = default (array [b.limbs.len, uint32 ])
27+ for i in 0 ..< limbs.len:
28+ res[i] = limbs[i].uint32
29+ else :
30+ {.error : " Logic to convert 64 bit limbs to 32 bit limbs at compile time still unfinished." .}
31+ # need twice as many limbs to go from 64bit to 32bit
32+ # # XXX: Use number of bits required to check if the
33+ # # last limbs needs to be dropped
34+ var res = default (array [b.limbs.len * 2 , uint32 ])
35+ for i in 0 ..< b.limbs.len:
36+ res[i* 2 ] = limbs[i].uint32
37+ res[i* 2 + 1 ] = (limbs[i] shr 32 ).uint32
2838 res
2939
3040template defBigInt * (N: typed ): untyped {.dirty .} =
You can’t perform that action at this time.
0 commit comments