Skip to content

Commit

Permalink
Update relic_bn_mul_low.c
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaranha authored Apr 26, 2024
1 parent bf8c7a3 commit b89695c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/low/x64-asm-6l/relic_bn_mul_low.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ void bn_muln_low(dig_t *c, const dig_t *a, const dig_t *b, int size) {
mpn_mul_n(c, a, b, size);
}

dig_t bn_muls_low(dig_t *c, const dig_t *a, dig_t sa, dis_t digit, int size) {
dig_t carry, sign, sd = digit >> (RLC_DIG - 1);

sa = -sa;
sign = sa ^ sd;
digit = (digit ^ sd) - sd;

carry = mpn_mul_1(c, a, size, digit);
for (size_t i = 0; i < size; i++) {
c[i] = c[i] ^ sign;
}
return (carry ^ sign) + mpn_add_1(c, c, size, -sign);
}

void bn_muld_low(dig_t *c, const dig_t *a, int sizea, const dig_t *b, int sizeb,
int low, int high) {
(void)low;
Expand Down

0 comments on commit b89695c

Please sign in to comment.