remove side effect inside parameter of macro MAX
This commit is contained in:
parent
b722832b32
commit
4fec1ae6f2
|
@ -16,12 +16,14 @@
|
||||||
/* two complement and */
|
/* two complement and */
|
||||||
int mp_tc_and(const mp_int *a, const mp_int *b, mp_int *c)
|
int mp_tc_and(const mp_int *a, const mp_int *b, mp_int *c)
|
||||||
{
|
{
|
||||||
int res = MP_OKAY, bits;
|
int res = MP_OKAY, bits, abits, bbits;
|
||||||
int as = mp_isneg(a), bs = mp_isneg(b);
|
int as = mp_isneg(a), bs = mp_isneg(b);
|
||||||
mp_int *mx = NULL, _mx, acpy, bcpy;
|
mp_int *mx = NULL, _mx, acpy, bcpy;
|
||||||
|
|
||||||
if ((as != MP_NO) || (bs != MP_NO)) {
|
if ((as != MP_NO) || (bs != MP_NO)) {
|
||||||
bits = MAX(mp_count_bits(a), mp_count_bits(b));
|
abits = mp_count_bits(a);
|
||||||
|
bbits = mp_count_bits(b);
|
||||||
|
bits = MAX(abits, bbits);
|
||||||
res = mp_init_set_int(&_mx, 1uL);
|
res = mp_init_set_int(&_mx, 1uL);
|
||||||
if (res != MP_OKAY) {
|
if (res != MP_OKAY) {
|
||||||
goto end;
|
goto end;
|
||||||
|
|
|
@ -16,12 +16,14 @@
|
||||||
/* two complement or */
|
/* two complement or */
|
||||||
int mp_tc_or(const mp_int *a, const mp_int *b, mp_int *c)
|
int mp_tc_or(const mp_int *a, const mp_int *b, mp_int *c)
|
||||||
{
|
{
|
||||||
int res = MP_OKAY, bits;
|
int res = MP_OKAY, bits, abits, bbits;
|
||||||
int as = mp_isneg(a), bs = mp_isneg(b);
|
int as = mp_isneg(a), bs = mp_isneg(b);
|
||||||
mp_int *mx = NULL, _mx, acpy, bcpy;
|
mp_int *mx = NULL, _mx, acpy, bcpy;
|
||||||
|
|
||||||
if ((as != MP_NO) || (bs != MP_NO)) {
|
if ((as != MP_NO) || (bs != MP_NO)) {
|
||||||
bits = MAX(mp_count_bits(a), mp_count_bits(b));
|
abits = mp_count_bits(a);
|
||||||
|
bbits = mp_count_bits(b);
|
||||||
|
bits = MAX(abits, bbits);
|
||||||
res = mp_init_set_int(&_mx, 1uL);
|
res = mp_init_set_int(&_mx, 1uL);
|
||||||
if (res != MP_OKAY) {
|
if (res != MP_OKAY) {
|
||||||
goto end;
|
goto end;
|
||||||
|
|
|
@ -16,12 +16,14 @@
|
||||||
/* two complement xor */
|
/* two complement xor */
|
||||||
int mp_tc_xor(const mp_int *a, const mp_int *b, mp_int *c)
|
int mp_tc_xor(const mp_int *a, const mp_int *b, mp_int *c)
|
||||||
{
|
{
|
||||||
int res = MP_OKAY, bits;
|
int res = MP_OKAY, bits, abits, bbits;
|
||||||
int as = mp_isneg(a), bs = mp_isneg(b);
|
int as = mp_isneg(a), bs = mp_isneg(b);
|
||||||
mp_int *mx = NULL, _mx, acpy, bcpy;
|
mp_int *mx = NULL, _mx, acpy, bcpy;
|
||||||
|
|
||||||
if ((as != MP_NO) || (bs != MP_NO)) {
|
if ((as != MP_NO) || (bs != MP_NO)) {
|
||||||
bits = MAX(mp_count_bits(a), mp_count_bits(b));
|
abits = mp_count_bits(a);
|
||||||
|
bbits = mp_count_bits(b);
|
||||||
|
bits = MAX(abits, bbits);
|
||||||
res = mp_init_set_int(&_mx, 1uL);
|
res = mp_init_set_int(&_mx, 1uL);
|
||||||
if (res != MP_OKAY) {
|
if (res != MP_OKAY) {
|
||||||
goto end;
|
goto end;
|
||||||
|
|
Loading…
Reference in New Issue