summaryrefslogtreecommitdiff
path: root/mpz/xor.c
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2018-01-17 05:34:55 +0100
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2018-01-17 05:34:55 +0100
commit31def9bb78d228bfec53e36e0ecf5640efc063a2 (patch)
tree0f52fc5809c8913534ef631a8b6cb1f6394fea5c /mpz/xor.c
parent94c6028a6de612a15d441bc8c20797175ba7e94a (diff)
downloadgmp-31def9bb78d228bfec53e36e0ecf5640efc063a2.tar.gz
mpz/{and,ior,xor}.c: Reindent
Diffstat (limited to 'mpz/xor.c')
-rw-r--r--mpz/xor.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/mpz/xor.c b/mpz/xor.c
index 9ddf2e9f0..5ec657a52 100644
--- a/mpz/xor.c
+++ b/mpz/xor.c
@@ -108,39 +108,39 @@ mpz_xor (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
SIZ(res) = res_size;
}
else
- {
- /* Operand 2 negative, so will be the result.
- -(OP1 ^ (-OP2)) = -(OP1 ^ ~(OP2 - 1)) =
- = ~(OP1 ^ ~(OP2 - 1)) + 1 =
- = (OP1 ^ (OP2 - 1)) + 1 */
-
- res_size = MAX (op1_size, op2_size);
- res_ptr = MPZ_REALLOC (res, res_size + 1);
- op1_ptr = PTR(op1);
-
- opx = TMP_ALLOC_LIMBS (op2_size);
- mpn_sub_1 (opx, PTR(op2), op2_size, (mp_limb_t) 1);
- op2_ptr = opx;
-
- if (res_size == op1_size)
- {
- MPN_COPY (res_ptr + op2_size, op1_ptr + op2_size, op1_size - op2_size);
- mpn_xor_n (res_ptr, op1_ptr, op2_ptr, op2_size);
- }
- else
- {
- MPN_COPY (res_ptr + op1_size, op2_ptr + op1_size, op2_size - op1_size);
- if (LIKELY (op1_size != 0))
- mpn_xor_n (res_ptr, op1_ptr, op2_ptr, op1_size);
- }
- TMP_FREE;
+ {
+ /* Operand 2 negative, so will be the result.
+ -(OP1 ^ (-OP2)) = -(OP1 ^ ~(OP2 - 1)) =
+ = ~(OP1 ^ ~(OP2 - 1)) + 1 =
+ = (OP1 ^ (OP2 - 1)) + 1 */
+
+ res_size = MAX (op1_size, op2_size);
+ res_ptr = MPZ_REALLOC (res, res_size + 1);
+ op1_ptr = PTR(op1);
+
+ opx = TMP_ALLOC_LIMBS (op2_size);
+ mpn_sub_1 (opx, PTR(op2), op2_size, (mp_limb_t) 1);
+ op2_ptr = opx;
+
+ if (res_size == op1_size)
+ {
+ MPN_COPY (res_ptr + op2_size, op1_ptr + op2_size, op1_size - op2_size);
+ mpn_xor_n (res_ptr, op1_ptr, op2_ptr, op2_size);
+ }
+ else
+ {
+ MPN_COPY (res_ptr + op1_size, op2_ptr + op1_size, op2_size - op1_size);
+ if (LIKELY (op1_size != 0))
+ mpn_xor_n (res_ptr, op1_ptr, op2_ptr, op1_size);
+ }
+ TMP_FREE;
- res_ptr[res_size] = 0;
- MPN_INCR_U (res_ptr, res_size + 1, (mp_limb_t) 1);
- res_size += res_ptr[res_size];
+ res_ptr[res_size] = 0;
+ MPN_INCR_U (res_ptr, res_size + 1, (mp_limb_t) 1);
+ res_size += res_ptr[res_size];
- MPN_NORMALIZE_NOT_ZERO (res_ptr, res_size);
- SIZ(res) = -res_size;
- }
+ MPN_NORMALIZE_NOT_ZERO (res_ptr, res_size);
+ SIZ(res) = -res_size;
+ }
}
}