Skip to content

Commit

Permalink
no_asm.h: address lgtm.com warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
dot-asm committed Nov 22, 2020
1 parent be0127c commit 7fb5564
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/no_asm.h
Original file line number Diff line number Diff line change
Expand Up @@ -688,29 +688,29 @@ limb_t div_3_limbs(const limb_t div_top[2], limb_t d_lo, limb_t d_hi)
size_t i;

for (i = 0; i < LIMB_T_BITS; i++) {
/* borrow, Rx = R - D; */
/* "borrow, Rx = R - D" */
Rx = (llimb_t)r_lo - d_lo;
rx = (limb_t)Rx;
borrow = (limb_t)(Rx >> LIMB_T_BITS) & 1;
Rx = r_hi - (d_hi + (llimb_t)borrow);
borrow = (limb_t)(Rx >> LIMB_T_BITS) & 1;

/* if (R >= D) R -= D; */
/* "if (R >= D) R -= D" */
r_lo = ((r_lo ^ rx) & (0 - borrow)) ^ rx;
rx = (limb_t)Rx;
r_hi = ((r_hi ^ rx) & (0 - borrow)) ^ rx;

Q <<= 1;
Q |= borrow ^ 1;

/* D >>= 1; */
/* "D >>= 1" */
d_lo >>= 1; d_lo |= d_hi << (LIMB_T_BITS - 1);
d_hi >>= 1;
}

mask = 0 - (Q >> (LIMB_T_BITS - 1)); /* does it overflow? */

/* borrow, Rx = R - D; */
/* "borrow, Rx = R - D" */
Rx = (llimb_t)r_lo - d_lo;
rx = (limb_t)Rx;
borrow = (limb_t)(Rx >> LIMB_T_BITS) & 1;
Expand Down

0 comments on commit 7fb5564

Please sign in to comment.