1
0
Fork 0
mirror of synced 2025-09-23 04:08:33 +00:00

remove extra asm assignments

This commit is contained in:
dark64 2023-06-13 12:43:20 +02:00
parent ce7708d7c6
commit e23f480651
2 changed files with 10 additions and 8 deletions

View file

@ -27,7 +27,8 @@ def bigint_from_u32_limbs<N, M>(u32[N] limbs) -> BigInteger<M> {
// Expand big integer from `N` limbs to `M` limbs
def bigint_expand<N, M>(BigInteger<N> input) -> BigInteger<M> {
return bigint_from_limbs(input.limbs);
BigInteger<M> r = bigint_from_limbs(input.limbs);
return r;
}
// Big integer addition (a + b)
@ -104,9 +105,11 @@ def bigint_mul<N, M>(BigInteger<N> a, BigInteger<N> b) -> BigInteger<M> {
field[K][3] mut split = [[0; 3]; K];
for u32 i in 0..K {
asm {
split[i][0] <-- ovf[i] % (1 << LIMB_BITWIDTH);
split[i][1] <-- (ovf[i] \ (1 << LIMB_BITWIDTH)) % (1 << LIMB_BITWIDTH);
split[i][2] <-- (ovf[i] \ (1 << LIMB_BITWIDTH * 2)) % (1 << LIMB_BITWIDTH);
split[i] <-- [
(ovf[i] % (1 << LIMB_BITWIDTH)),
(ovf[i] \ (1 << LIMB_BITWIDTH)) % (1 << LIMB_BITWIDTH),
(ovf[i] \ (1 << LIMB_BITWIDTH * 2)) % (1 << LIMB_BITWIDTH)
];
}
}

View file

@ -19,12 +19,11 @@ def ilog2(u32 x) -> u32 {
}
def split<N>(field input) -> field[2] {
field[2] mut r = [0; 2];
field[2] mut res = [0; 2];
asm {
r[0] <-- input % (1 << N);
r[1] <-- (input \ (1 << N)) % (1 << N);
res <-- [input % (1 << N), (input \ (1 << N)) % (1 << N)];
}
return r;
return res;
}
def split2<K, N>(field[K] mut limbs, field[K] mut carry, field[K][3] split) -> (field[K], field[K]) {