explicit condition
This commit is contained in:
parent
519a1de8da
commit
482cf1e128
|
@ -17,7 +17,7 @@
|
|||
int mp_complement(const mp_int *a, mp_int *b)
|
||||
{
|
||||
int res = mp_neg(a, b);
|
||||
return res == MP_OKAY ? mp_sub_d(b, 1uL, b) : res;
|
||||
return (res == MP_OKAY) ? mp_sub_d(b, 1uL, b) : res;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ int mp_tc_and(const mp_int *a, const mp_int *b, mp_int *c)
|
|||
int as = mp_isneg(a), bs = mp_isneg(b), s = 0;
|
||||
mp_int *mx = NULL, _mx, acpy, bcpy;
|
||||
|
||||
if (as || bs) {
|
||||
if ((as != MP_NO) || (bs != MP_NO)) {
|
||||
bits = MAX(mp_count_bits(a), mp_count_bits(b));
|
||||
res = mp_init_set_int(&_mx, 1uL);
|
||||
if (res != MP_OKAY) {
|
||||
|
@ -33,7 +33,7 @@ int mp_tc_and(const mp_int *a, const mp_int *b, mp_int *c)
|
|||
goto end;
|
||||
}
|
||||
|
||||
if (as) {
|
||||
if (as != MP_NO) {
|
||||
res = mp_init(&acpy);
|
||||
if (res != MP_OKAY) {
|
||||
goto end;
|
||||
|
@ -46,7 +46,7 @@ int mp_tc_and(const mp_int *a, const mp_int *b, mp_int *c)
|
|||
}
|
||||
a = &acpy;
|
||||
}
|
||||
if (bs) {
|
||||
if (bs != MP_NO) {
|
||||
res = mp_init(&bcpy);
|
||||
if (res != MP_OKAY) {
|
||||
goto end;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
int mp_tc_div_2d(const mp_int *a, int b, mp_int *c)
|
||||
{
|
||||
int res;
|
||||
if (!mp_isneg(a)) {
|
||||
if (mp_isneg(a) == MP_NO) {
|
||||
return mp_div_2d(a, b, c, NULL);
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ int mp_tc_div_2d(const mp_int *a, int b, mp_int *c)
|
|||
}
|
||||
|
||||
res = mp_div_2d(c, b, c, NULL);
|
||||
return res == MP_OKAY ? mp_sub_d(c, 1uL, c) : res;
|
||||
return (res == MP_OKAY) ? mp_sub_d(c, 1uL, c) : res;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ int mp_tc_or(const mp_int *a, const mp_int *b, mp_int *c)
|
|||
int as = mp_isneg(a), bs = mp_isneg(b), s = 0;
|
||||
mp_int *mx = NULL, _mx, acpy, bcpy;
|
||||
|
||||
if (as || bs) {
|
||||
if ((as != MP_NO) || (bs != MP_NO)) {
|
||||
bits = MAX(mp_count_bits(a), mp_count_bits(b));
|
||||
res = mp_init_set_int(&_mx, 1uL);
|
||||
if (res != MP_OKAY) {
|
||||
|
@ -33,7 +33,7 @@ int mp_tc_or(const mp_int *a, const mp_int *b, mp_int *c)
|
|||
goto end;
|
||||
}
|
||||
|
||||
if (as) {
|
||||
if (as != MP_NO) {
|
||||
res = mp_init(&acpy);
|
||||
if (res != MP_OKAY) {
|
||||
goto end;
|
||||
|
@ -46,7 +46,7 @@ int mp_tc_or(const mp_int *a, const mp_int *b, mp_int *c)
|
|||
}
|
||||
a = &acpy;
|
||||
}
|
||||
if (bs) {
|
||||
if (bs != MP_NO) {
|
||||
res = mp_init(&bcpy);
|
||||
if (res != MP_OKAY) {
|
||||
goto end;
|
||||
|
|
|
@ -20,7 +20,7 @@ int mp_tc_xor(const mp_int *a, const mp_int *b, mp_int *c)
|
|||
int as = mp_isneg(a), bs = mp_isneg(b), s = 0;
|
||||
mp_int *mx = NULL, _mx, acpy, bcpy;
|
||||
|
||||
if (as || bs) {
|
||||
if ((as != MP_NO) || (bs != MP_NO)) {
|
||||
bits = MAX(mp_count_bits(a), mp_count_bits(b));
|
||||
res = mp_init_set_int(&_mx, 1uL);
|
||||
if (res != MP_OKAY) {
|
||||
|
@ -33,7 +33,7 @@ int mp_tc_xor(const mp_int *a, const mp_int *b, mp_int *c)
|
|||
goto end;
|
||||
}
|
||||
|
||||
if (as) {
|
||||
if (as != MP_NO) {
|
||||
res = mp_init(&acpy);
|
||||
if (res != MP_OKAY) {
|
||||
goto end;
|
||||
|
@ -46,7 +46,7 @@ int mp_tc_xor(const mp_int *a, const mp_int *b, mp_int *c)
|
|||
}
|
||||
a = &acpy;
|
||||
}
|
||||
if (bs) {
|
||||
if (bs != MP_NO) {
|
||||
res = mp_init(&bcpy);
|
||||
if (res != MP_OKAY) {
|
||||
goto end;
|
||||
|
|
Loading…
Reference in New Issue