summaryrefslogtreecommitdiff
path: root/mpz/aorsmul_i.c
diff options
context:
space:
mode:
authorTorbjorn Granlund <tege@gmplib.org>2010-11-22 22:26:05 +0100
committerTorbjorn Granlund <tege@gmplib.org>2010-11-22 22:26:05 +0100
commit198a1add0f2d556eb75bf2d85c7fceb9fafe9f51 (patch)
treec4fa3b97e983d3f057c0ba032faf39fe303d8f3b /mpz/aorsmul_i.c
parentd7afa9ea9c7dae166cb6719c3b11db9c96cca519 (diff)
downloadgmp-198a1add0f2d556eb75bf2d85c7fceb9fafe9f51.tar.gz
Whitespace cleanup.
Diffstat (limited to 'mpz/aorsmul_i.c')
-rw-r--r--mpz/aorsmul_i.c108
1 files changed, 54 insertions, 54 deletions
diff --git a/mpz/aorsmul_i.c b/mpz/aorsmul_i.c
index b3c2efae4..a5e18bb0f 100644
--- a/mpz/aorsmul_i.c
+++ b/mpz/aorsmul_i.c
@@ -104,25 +104,25 @@ mpz_aorsmul_1 (mpz_ptr w, mpz_srcptr x, mp_limb_t y, mp_size_t sub)
dsize = xsize - wsize;
#if HAVE_NATIVE_mpn_mul_1c
if (dsize > 0)
- cy = mpn_mul_1c (wp, xp, dsize, y, cy);
+ cy = mpn_mul_1c (wp, xp, dsize, y, cy);
else if (dsize < 0)
- {
- dsize = -dsize;
- cy = mpn_add_1 (wp, wp, dsize, cy);
- }
+ {
+ dsize = -dsize;
+ cy = mpn_add_1 (wp, wp, dsize, cy);
+ }
#else
if (dsize != 0)
- {
- mp_limb_t cy2;
- if (dsize > 0)
- cy2 = mpn_mul_1 (wp, xp, dsize, y);
- else
- {
- dsize = -dsize;
- cy2 = 0;
- }
- cy = cy2 + mpn_add_1 (wp, wp, dsize, cy);
- }
+ {
+ mp_limb_t cy2;
+ if (dsize > 0)
+ cy2 = mpn_mul_1 (wp, xp, dsize, y);
+ else
+ {
+ dsize = -dsize;
+ cy2 = 0;
+ }
+ cy = cy2 + mpn_add_1 (wp, wp, dsize, cy);
+ }
#endif
wp[dsize] = cy;
@@ -134,52 +134,52 @@ mpz_aorsmul_1 (mpz_ptr w, mpz_srcptr x, mp_limb_t y, mp_size_t sub)
cy = mpn_submul_1 (wp, xp, min_size, y);
if (wsize >= xsize)
- {
- /* if w bigger than x, then propagate borrow through it */
- if (wsize != xsize)
- cy = mpn_sub_1 (wp+xsize, wp+xsize, wsize-xsize, cy);
-
- if (cy != 0)
- {
- /* Borrow out of w, take twos complement negative to get
- absolute value, flip sign of w. */
- wp[new_wsize] = ~-cy; /* extra limb is 0-cy */
- mpn_com (wp, wp, new_wsize);
- new_wsize++;
- MPN_INCR_U (wp, new_wsize, CNST_LIMB(1));
- wsize_signed = -wsize_signed;
- }
- }
+ {
+ /* if w bigger than x, then propagate borrow through it */
+ if (wsize != xsize)
+ cy = mpn_sub_1 (wp+xsize, wp+xsize, wsize-xsize, cy);
+
+ if (cy != 0)
+ {
+ /* Borrow out of w, take twos complement negative to get
+ absolute value, flip sign of w. */
+ wp[new_wsize] = ~-cy; /* extra limb is 0-cy */
+ mpn_com (wp, wp, new_wsize);
+ new_wsize++;
+ MPN_INCR_U (wp, new_wsize, CNST_LIMB(1));
+ wsize_signed = -wsize_signed;
+ }
+ }
else /* wsize < xsize */
- {
- /* x bigger than w, so want x*y-w. Submul has given w-x*y, so
- take twos complement and use an mpn_mul_1 for the rest. */
+ {
+ /* x bigger than w, so want x*y-w. Submul has given w-x*y, so
+ take twos complement and use an mpn_mul_1 for the rest. */
- mp_limb_t cy2;
+ mp_limb_t cy2;
- /* -(-cy*b^n + w-x*y) = (cy-1)*b^n + ~(w-x*y) + 1 */
- mpn_com (wp, wp, wsize);
- cy += mpn_add_1 (wp, wp, wsize, CNST_LIMB(1));
- cy -= 1;
+ /* -(-cy*b^n + w-x*y) = (cy-1)*b^n + ~(w-x*y) + 1 */
+ mpn_com (wp, wp, wsize);
+ cy += mpn_add_1 (wp, wp, wsize, CNST_LIMB(1));
+ cy -= 1;
- /* If cy-1 == -1 then hold that -1 for latter. mpn_submul_1 never
- returns cy==MP_LIMB_T_MAX so that value always indicates a -1. */
- cy2 = (cy == MP_LIMB_T_MAX);
- cy += cy2;
- MPN_MUL_1C (cy, wp+wsize, xp+wsize, xsize-wsize, y, cy);
- wp[new_wsize] = cy;
- new_wsize += (cy != 0);
+ /* If cy-1 == -1 then hold that -1 for latter. mpn_submul_1 never
+ returns cy==MP_LIMB_T_MAX so that value always indicates a -1. */
+ cy2 = (cy == MP_LIMB_T_MAX);
+ cy += cy2;
+ MPN_MUL_1C (cy, wp+wsize, xp+wsize, xsize-wsize, y, cy);
+ wp[new_wsize] = cy;
+ new_wsize += (cy != 0);
- /* Apply any -1 from above. The value at wp+wsize is non-zero
- because y!=0 and the high limb of x will be non-zero. */
- if (cy2)
- MPN_DECR_U (wp+wsize, new_wsize-wsize, CNST_LIMB(1));
+ /* Apply any -1 from above. The value at wp+wsize is non-zero
+ because y!=0 and the high limb of x will be non-zero. */
+ if (cy2)
+ MPN_DECR_U (wp+wsize, new_wsize-wsize, CNST_LIMB(1));
- wsize_signed = -wsize_signed;
- }
+ wsize_signed = -wsize_signed;
+ }
/* submul can produce high zero limbs due to cancellation, both when w
- has more limbs or x has more */
+ has more limbs or x has more */
MPN_NORMALIZE (wp, new_wsize);
}