explicit operator precedence
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
diff --git a/bn_mp_and.c b/bn_mp_and.c
index 1ee14e8..e781f31 100644
--- a/bn_mp_and.c
+++ b/bn_mp_and.c
@@ -9,7 +9,7 @@ mp_err mp_and(const mp_int *a, const mp_int *b, mp_int *c)
int used = MP_MAX(a->used, b->used) + 1, i;
mp_err err;
mp_digit ac = 1, bc = 1, cc = 1;
- mp_sign csign = (a->sign == MP_NEG && b->sign == MP_NEG) ? MP_NEG : MP_ZPOS;
+ mp_sign csign = ((a->sign == MP_NEG) && (b->sign == MP_NEG)) ? MP_NEG : MP_ZPOS;
if (c->alloc < used) {
if ((err = mp_grow(c, used)) != MP_OKAY) {
@@ -22,20 +22,20 @@ mp_err mp_and(const mp_int *a, const mp_int *b, mp_int *c)
/* convert to two complement if negative */
if (a->sign == MP_NEG) {
- ac += i >= a->used ? MP_MASK : ~a->dp[i] & MP_MASK;
+ ac += (i >= a->used) ? MP_MASK : (~a->dp[i] & MP_MASK);
x = ac & MP_MASK;
ac >>= MP_DIGIT_BIT;
} else {
- x = i >= a->used ? 0 : a->dp[i];
+ x = (i >= a->used) ? 0 : a->dp[i];
}
/* convert to two complement if negative */
if (b->sign == MP_NEG) {
- bc += i >= b->used ? MP_MASK : ~b->dp[i] & MP_MASK;
+ bc += (i >= b->used) ? MP_MASK : (~b->dp[i] & MP_MASK);
y = bc & MP_MASK;
bc >>= MP_DIGIT_BIT;
} else {
- y = i >= b->used ? 0 : b->dp[i];
+ y = (i >= b->used) ? 0 : b->dp[i];
}
c->dp[i] = x & y;
diff --git a/bn_mp_or.c b/bn_mp_or.c
index 6102a8a..6f09a70 100644
--- a/bn_mp_or.c
+++ b/bn_mp_or.c
@@ -9,7 +9,7 @@ mp_err mp_or(const mp_int *a, const mp_int *b, mp_int *c)
int used = MP_MAX(a->used, b->used) + 1, i;
mp_err err;
mp_digit ac = 1, bc = 1, cc = 1;
- mp_sign csign = (a->sign == MP_NEG || b->sign == MP_NEG) ? MP_NEG : MP_ZPOS;
+ mp_sign csign = ((a->sign == MP_NEG) || (b->sign == MP_NEG)) ? MP_NEG : MP_ZPOS;
if (c->alloc < used) {
if ((err = mp_grow(c, used)) != MP_OKAY) {
@@ -22,20 +22,20 @@ mp_err mp_or(const mp_int *a, const mp_int *b, mp_int *c)
/* convert to two complement if negative */
if (a->sign == MP_NEG) {
- ac += i >= a->used ? MP_MASK : ~a->dp[i] & MP_MASK;
+ ac += (i >= a->used) ? MP_MASK : (~a->dp[i] & MP_MASK);
x = ac & MP_MASK;
ac >>= MP_DIGIT_BIT;
} else {
- x = i >= a->used ? 0 : a->dp[i];
+ x = (i >= a->used) ? 0 : a->dp[i];
}
/* convert to two complement if negative */
if (b->sign == MP_NEG) {
- bc += i >= b->used ? MP_MASK : ~b->dp[i] & MP_MASK;
+ bc += (i >= b->used) ? MP_MASK : (~b->dp[i] & MP_MASK);
y = bc & MP_MASK;
bc >>= MP_DIGIT_BIT;
} else {
- y = i >= b->used ? 0 : b->dp[i];
+ y = (i >= b->used) ? 0 : b->dp[i];
}
c->dp[i] = x | y;
diff --git a/bn_mp_xor.c b/bn_mp_xor.c
index c066e65..90958d4 100644
--- a/bn_mp_xor.c
+++ b/bn_mp_xor.c
@@ -22,20 +22,20 @@ mp_err mp_xor(const mp_int *a, const mp_int *b, mp_int *c)
/* convert to two complement if negative */
if (a->sign == MP_NEG) {
- ac += i >= a->used ? MP_MASK : ~a->dp[i] & MP_MASK;
+ ac += (i >= a->used) ? MP_MASK : (~a->dp[i] & MP_MASK);
x = ac & MP_MASK;
ac >>= MP_DIGIT_BIT;
} else {
- x = i >= a->used ? 0 : a->dp[i];
+ x = (i >= a->used) ? 0 : a->dp[i];
}
/* convert to two complement if negative */
if (b->sign == MP_NEG) {
- bc += i >= b->used ? MP_MASK : ~b->dp[i] & MP_MASK;
+ bc += (i >= b->used) ? MP_MASK : (~b->dp[i] & MP_MASK);
y = bc & MP_MASK;
bc >>= MP_DIGIT_BIT;
} else {
- y = i >= b->used ? 0 : b->dp[i];
+ y = (i >= b->used) ? 0 : b->dp[i];
}
c->dp[i] = x ^ y;
diff --git a/bn_s_mp_toom_mul.c b/bn_s_mp_toom_mul.c
index e80b6f6..ce47f25 100644
--- a/bn_s_mp_toom_mul.c
+++ b/bn_s_mp_toom_mul.c
@@ -63,7 +63,7 @@ mp_err s_mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c)
goto LTM_ERRa2;
}
for (; count < a->used; count++) {
- a2.dp[count - 2 * B] = a->dp[count];
+ a2.dp[count - (2 * B)] = a->dp[count];
a2.used++;
}
@@ -88,7 +88,7 @@ mp_err s_mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c)
goto LTM_ERRb2;
}
for (; count < b->used; count++) {
- b2.dp[count - 2 * B] = b->dp[count];
+ b2.dp[count - (2 * B)] = b->dp[count];
b2.used++;
}