Skip to content

Commit 33737cd

Browse files
committed
fix some usages of enum types
1 parent b725bbd commit 33737cd

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

bn_mp_ilogb.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static mp_digit s_digit_ilogb(mp_digit base, mp_digit n)
7373
mp_err mp_ilogb(const mp_int *a, mp_digit base, mp_int *c)
7474
{
7575
mp_err err;
76-
int cmp;
76+
mp_ord cmp;
7777
unsigned int high, low, mid;
7878
mp_int bracket_low, bracket_high, bracket_mid, t, bi_base;
7979
mp_digit tmp;
@@ -90,8 +90,7 @@ mp_err mp_ilogb(const mp_int *a, mp_digit base, mp_int *c)
9090
return MP_VAL;
9191
}
9292
if (base == 2u) {
93-
cmp = mp_count_bits(a) - 1;
94-
mp_set_int(c, (unsigned long)cmp);
93+
mp_set_int(c, (unsigned long)(mp_count_bits(a) - 1));
9594
return err;
9695
}
9796
if (a->used == 1) {

bn_mp_n_root_ex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
mp_err mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast)
1616
{
1717
mp_int t1, t2, t3, a_;
18-
int cmp;
18+
mp_ord cmp;
1919
int ilog2;
2020
mp_err res;
2121

bn_mp_prime_is_prime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ mp_err mp_prime_is_prime(const mp_int *a, int t, mp_bool *result)
5151
if ((err = mp_is_square(a, &res)) != MP_OKAY) {
5252
return err;
5353
}
54-
if (res != 0) {
54+
if (res != MP_NO) {
5555
return MP_OKAY;
5656
}
5757

bn_mp_prime_strong_lucas_selfridge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ mp_err mp_prime_strong_lucas_selfridge(const mp_int *a, mp_bool *result)
7272
/* CZ TODO: Some of them need the full 32 bit, hence the (temporary) exclusion of MP_8BIT */
7373
int32_t D, Ds, J, sign, P, Q, r, s, u, Nbits;
7474
mp_err e;
75-
int oddness;
75+
mp_bool oddness;
7676

7777
*result = MP_NO;
7878
/*

demo/test.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ static int test_s_mp_jacobi(void)
148148
{ 9, { -1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1 } },
149149
};
150150

151-
int i, n, should, cnt;
152-
mp_err err;
151+
int i, n, cnt;
152+
mp_err err, should;
153153
mp_int a, b;
154154
if (mp_init_multi(&a, &b, NULL)!= MP_OKAY) {
155155
return EXIT_FAILURE;
@@ -1267,9 +1267,10 @@ static int test_mp_reduce_2k_l(void)
12671267
}
12681268
/* stripped down version of mp_radix_size. The faster version can be off by up t
12691269
o +3 */
1270-
static int s_rs(const mp_int *a, int radix, int *size)
1270+
static mp_err s_rs(const mp_int *a, int radix, int *size)
12711271
{
1272-
int res, digs = 0;
1272+
mp_err res;
1273+
int digs = 0;
12731274
mp_int t;
12741275
mp_digit d;
12751276
*size = 0;
@@ -1431,7 +1432,7 @@ static int test_mp_ilogb(void)
14311432
static int test_mp_incr(void)
14321433
{
14331434
mp_int a, b;
1434-
int e = MP_OKAY;
1435+
mp_err e = MP_OKAY;
14351436

14361437
if ((e = mp_init_multi(&a, &b, NULL)) != MP_OKAY) {
14371438
goto LTM_ERR;
@@ -1496,7 +1497,7 @@ static int test_mp_incr(void)
14961497
static int test_mp_decr(void)
14971498
{
14981499
mp_int a, b;
1499-
int e = MP_OKAY;
1500+
mp_err e = MP_OKAY;
15001501

15011502
if ((e = mp_init_multi(&a, &b, NULL)) != MP_OKAY) {
15021503
goto LTM_ERR;
@@ -1585,7 +1586,7 @@ static int test_mp_decr(void)
15851586
static int test_mp_n_root(void)
15861587
{
15871588
mp_int a, c, r;
1588-
int e;
1589+
mp_err e;
15891590
int i, j;
15901591

15911592
const char *input[] = {
@@ -1803,7 +1804,7 @@ static int test_mp_n_root(void)
18031804
static int test_s_mp_balance_mul(void)
18041805
{
18051806
mp_int a, b, c;
1806-
int e = MP_OKAY;
1807+
mp_err e = MP_OKAY;
18071808

18081809
const char *na =
18091810
"4b0I5uMTujCysw+1OOuOyH2FX2WymrHUqi8BBDb7XpkV/4i7vXTbEYUy/kdIfCKu5jT5JEqYkdmnn3jAYo8XShPzNLxZx9yoLjxYRyptSuOI2B1DspvbIVYXY12sxPZ4/HCJ4Usm2MU5lO/006KnDMxuxiv1rm6YZJZ0eZU";

0 commit comments

Comments
 (0)