Use NLIMBS where appropriate to simplify the code
@@ -29,7 +29,7 @@ void gf_sub_RAW(gf out, const gf a, const gf b)
{
unsigned int i;
- for (i = 0; i < sizeof(*out) / sizeof(out->limb[0]); i++) {
+ for (i = 0; i < NLIMBS; i++) {
out->limb[i] = a->limb[i] - b->limb[i];
}
}
@@ -39,7 +39,7 @@ void gf_bias(gf a, int amt)
unsigned int i;
uint32_t co1 = ((1 << 28) - 1) * amt, co2 = co1 - amt;
- for (i = 0; i < sizeof(*a) / sizeof(a->limb[0]); i++)
+ for (i = 0; i < NLIMBS; i++)
a->limb[i] += (i == sizeof(*a) / sizeof(a->limb[0]) / 2) ? co2 : co1;
}
