Fix warnings (clang 3.6)
This commit is contained in:
@@ -29,7 +29,7 @@ mp_rand (mp_int * a, int digits)
|
||||
|
||||
/* first place a random non-zero digit */
|
||||
do {
|
||||
d = ((mp_digit) abs (rand ())) & MP_MASK;
|
||||
d = ((mp_digit) labs (rand ())) & MP_MASK;
|
||||
} while (d == 0);
|
||||
|
||||
if ((res = mp_add_d (a, d, a)) != MP_OKAY) {
|
||||
@@ -41,7 +41,7 @@ mp_rand (mp_int * a, int digits)
|
||||
return res;
|
||||
}
|
||||
|
||||
if ((res = mp_add_d (a, ((mp_digit) abs (rand ())), a)) != MP_OKAY) {
|
||||
if ((res = mp_add_d (a, ((mp_digit) labs (rand ())), a)) != MP_OKAY) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
@@ -83,7 +83,7 @@ int main(void)
|
||||
|
||||
// now test a random reduction
|
||||
for (ix = 0; ix < 100; ix++) {
|
||||
mp_rand(&c, 1 + abs(rand()) % (2*i));
|
||||
mp_rand(&c, 1 + labs(rand()) % (2*i));
|
||||
mp_copy(&c, &d);
|
||||
mp_copy(&c, &e);
|
||||
|
||||
@@ -286,7 +286,7 @@ printf("compare no compare!\n"); exit(EXIT_FAILURE); }
|
||||
|
||||
if (!(++cnt & 127))
|
||||
printf("%9d\r", cnt);
|
||||
mp_rand(&a, abs(rand()) % 128 + 1);
|
||||
mp_rand(&a, labs(rand()) % 128 + 1);
|
||||
mp_div(&a, &d, &b, &e);
|
||||
mp_div_3(&a, &c, &r2);
|
||||
|
||||
@@ -394,7 +394,7 @@ printf("compare no compare!\n"); exit(EXIT_FAILURE); }
|
||||
|
||||
for (;;) {
|
||||
/* randomly clear and re-init one variable, this has the affect of triming the alloc space */
|
||||
switch (abs(rand()) % 7) {
|
||||
switch (labs(rand()) % 7) {
|
||||
case 0:
|
||||
mp_clear(&a);
|
||||
mp_init(&a);
|
||||
|
@@ -163,7 +163,7 @@ mp_digit prime_digit(void)
|
||||
int n;
|
||||
mp_digit d;
|
||||
|
||||
n = abs(rand()) % n_prime;
|
||||
n = labs(rand()) % n_prime;
|
||||
fseek(primes, n * sizeof(mp_digit), SEEK_SET);
|
||||
fread(&d, 1, sizeof(mp_digit), primes);
|
||||
return d;
|
||||
|
@@ -492,7 +492,7 @@ void mp_set(mp_int *mp, mp_digit d)
|
||||
mp_err mp_set_int(mp_int *mp, long z)
|
||||
{
|
||||
int ix;
|
||||
unsigned long v = abs(z);
|
||||
unsigned long v = labs(z);
|
||||
mp_err res;
|
||||
|
||||
ARGCHK(mp != NULL, MP_BADARG);
|
||||
|
@@ -281,7 +281,7 @@ int main(void)
|
||||
printf("%s\n", buf);
|
||||
} else if (n == 13) {
|
||||
rand_num2(&a);
|
||||
tmp = abs(rand()) & THE_MASK;
|
||||
tmp = labs(rand()) & THE_MASK;
|
||||
mp_add_d(&a, tmp, &b);
|
||||
printf("add_d\n");
|
||||
mp_to64(&a, buf);
|
||||
@@ -290,7 +290,7 @@ int main(void)
|
||||
printf("%s\n", buf);
|
||||
} else if (n == 14) {
|
||||
rand_num2(&a);
|
||||
tmp = abs(rand()) & THE_MASK;
|
||||
tmp = labs(rand()) & THE_MASK;
|
||||
mp_sub_d(&a, tmp, &b);
|
||||
printf("sub_d\n");
|
||||
mp_to64(&a, buf);
|
||||
|
@@ -19,7 +19,7 @@
|
||||
\def\gcd{{\rm gcd}}
|
||||
\def\log{{\rm log}}
|
||||
\def\ord{{\rm ord}}
|
||||
\def\abs{{\mathit abs}}
|
||||
\def\labs{{\mathit labs}}
|
||||
\def\rep{{\mathit rep}}
|
||||
\def\mod{{\mathit\ mod\ }}
|
||||
\renewcommand{\pmod}[1]{\ ({\rm mod\ }{#1})}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
\def\gcd{{\rm gcd}}
|
||||
\def\log{{\rm log}}
|
||||
\def\ord{{\rm ord}}
|
||||
\def\abs{{\mathit abs}}
|
||||
\def\labs{{\mathit labs}}
|
||||
\def\rep{{\mathit rep}}
|
||||
\def\mod{{\mathit\ mod\ }}
|
||||
\renewcommand{\pmod}[1]{\ ({\rm mod\ }{#1})}
|
||||
|
Reference in New Issue
Block a user