mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-18 21:29:18 +02:00
Fix libtommath warnings
This commit is contained in:
parent
f4b81ccb73
commit
c9921ce69a
2 changed files with 10 additions and 10 deletions
|
@ -1245,7 +1245,7 @@
|
||||||
return_closcall1(data, k, obj_int2obj( labs( obj_obj2int(num))));
|
return_closcall1(data, k, obj_int2obj( labs( obj_obj2int(num))));
|
||||||
} else if (is_object_type(num) && type_of(num) == bignum_tag){
|
} else if (is_object_type(num) && type_of(num) == bignum_tag){
|
||||||
alloc_bignum(data, bn);
|
alloc_bignum(data, bn);
|
||||||
mp_abs(&bignum_value(num), &bignum_value(bn));
|
BIGNUM_CALL(mp_abs(&bignum_value(num), &bignum_value(bn)));
|
||||||
return_closcall1(data, k, bn);
|
return_closcall1(data, k, bn);
|
||||||
} else {
|
} else {
|
||||||
make_double(d, fabs(((double_type *)num)->value));
|
make_double(d, fabs(((double_type *)num)->value));
|
||||||
|
|
18
srfi/60.scm
18
srfi/60.scm
|
@ -51,7 +51,7 @@
|
||||||
mp_int tmpx, tmpy;
|
mp_int tmpx, tmpy;
|
||||||
|
|
||||||
if (obj_is_int(x)) {
|
if (obj_is_int(x)) {
|
||||||
mp_init(&tmpx);
|
BIGNUM_CALL(mp_init(&tmpx));
|
||||||
Cyc_int2bignum(obj_obj2int(x), &tmpx);
|
Cyc_int2bignum(obj_obj2int(x), &tmpx);
|
||||||
xx = &tmpx;
|
xx = &tmpx;
|
||||||
} else {
|
} else {
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj_is_int(y)) {
|
if (obj_is_int(y)) {
|
||||||
mp_init(&tmpy);
|
BIGNUM_CALL(mp_init(&tmpy));
|
||||||
Cyc_int2bignum(obj_obj2int(y), &tmpy);
|
Cyc_int2bignum(obj_obj2int(y), &tmpy);
|
||||||
yy = &tmpy;
|
yy = &tmpy;
|
||||||
} else {
|
} else {
|
||||||
|
@ -123,7 +123,7 @@
|
||||||
"Cyc_check_int(data, x);
|
"Cyc_check_int(data, x);
|
||||||
alloc_bignum(data, bn);
|
alloc_bignum(data, bn);
|
||||||
if (Cyc_is_bignum(x) == boolean_t) {
|
if (Cyc_is_bignum(x) == boolean_t) {
|
||||||
mp_copy(&bignum_value(x), &bignum_value(bn));
|
BIGNUM_CALL(mp_copy(&bignum_value(x), &bignum_value(bn)));
|
||||||
} else {
|
} else {
|
||||||
Cyc_int2bignum((int)unbox_number(x), &bignum_value(bn));
|
Cyc_int2bignum((int)unbox_number(x), &bignum_value(bn));
|
||||||
}
|
}
|
||||||
|
@ -132,8 +132,8 @@
|
||||||
/* A one's complement, aka bitwise NOT, is actually just -a - 1 */
|
/* A one's complement, aka bitwise NOT, is actually just -a - 1 */
|
||||||
//CHECK_ERROR(mp_neg(&op->mp, &out->mp));
|
//CHECK_ERROR(mp_neg(&op->mp, &out->mp));
|
||||||
//CHECK_ERROR(mp_sub_d(&out->mp, 1, &out->mp));
|
//CHECK_ERROR(mp_sub_d(&out->mp, 1, &out->mp));
|
||||||
mp_neg(&bignum_value(bn), &bignum_value(bn));
|
BIGNUM_CALL(mp_neg(&bignum_value(bn), &bignum_value(bn)));
|
||||||
mp_sub_d(&bignum_value(bn), 1, &bignum_value(bn));
|
BIGNUM_CALL(mp_sub_d(&bignum_value(bn), 1, &bignum_value(bn)));
|
||||||
return_closcall1(data, k, Cyc_bignum_normalize(data, bn));
|
return_closcall1(data, k, Cyc_bignum_normalize(data, bn));
|
||||||
")
|
")
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@
|
||||||
"Cyc_check_int(data, x);
|
"Cyc_check_int(data, x);
|
||||||
if (Cyc_is_bignum(x) == boolean_t) {
|
if (Cyc_is_bignum(x) == boolean_t) {
|
||||||
int res;
|
int res;
|
||||||
mp_radix_size(&bignum_value(x), 2, &res);
|
BIGNUM_CALL(mp_radix_size(&bignum_value(x), 2, &res));
|
||||||
return_closcall1(data, k, obj_int2obj((res - 1)));
|
return_closcall1(data, k, obj_int2obj((res - 1)));
|
||||||
} else {
|
} else {
|
||||||
int input = (int)unbox_number(x);
|
int input = (int)unbox_number(x);
|
||||||
|
@ -247,7 +247,7 @@
|
||||||
alloc_bignum(data, bn);
|
alloc_bignum(data, bn);
|
||||||
|
|
||||||
if (Cyc_is_bignum(x) == boolean_t){
|
if (Cyc_is_bignum(x) == boolean_t){
|
||||||
mp_copy(&bignum_value(x), &bignum_value(bn));
|
BIGNUM_CALL(mp_copy(&bignum_value(x), &bignum_value(bn)));
|
||||||
} else {
|
} else {
|
||||||
Cyc_int2bignum((int)unbox_number(x), &bignum_value(bn));
|
Cyc_int2bignum((int)unbox_number(x), &bignum_value(bn));
|
||||||
}
|
}
|
||||||
|
@ -257,11 +257,11 @@
|
||||||
shift = (int)unbox_number(y);
|
shift = (int)unbox_number(y);
|
||||||
if (shift > 0) {
|
if (shift > 0) {
|
||||||
for (i = 0; i < shift; i++) {
|
for (i = 0; i < shift; i++) {
|
||||||
mp_mul_2(&bignum_value(bn), &bignum_value(bn));
|
BIGNUM_CALL(mp_mul_2(&bignum_value(bn), &bignum_value(bn)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < abs(shift); i++) {
|
for (i = 0; i < abs(shift); i++) {
|
||||||
mp_div_2(&bignum_value(bn), &bignum_value(bn));
|
BIGNUM_CALL(mp_div_2(&bignum_value(bn), &bignum_value(bn)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue