From 11deca47b438be4e1ba741fe9487d4c49e206411 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Wed, 5 May 2010 22:22:13 -0700 Subject: [PATCH] quiet some data conversions warnings raised by msvc --- vm/bignum.cpp | 24 ++++++++++++------------ vm/factor.cpp | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/vm/bignum.cpp b/vm/bignum.cpp index c3d47d45f3..47896340cd 100755 --- a/vm/bignum.cpp +++ b/vm/bignum.cpp @@ -330,7 +330,7 @@ bignum *factor_vm::bignum_remainder(bignum * numerator, bignum * denominator) } /* allocates memory */ -#define FOO_TO_BIGNUM(name,type,utype) \ +#define FOO_TO_BIGNUM(name,type,stype,utype) \ bignum * factor_vm::name##_to_bignum(type n) \ { \ int negative_p; \ @@ -341,7 +341,7 @@ bignum * factor_vm::name##_to_bignum(type n) \ if (n == 1) return (BIGNUM_ONE (0)); \ if (n < (type)0 && n == (type)-1) return (BIGNUM_ONE (1)); \ { \ - utype accumulator = ((negative_p = (n < (type)0)) ? (-n) : n); \ + utype accumulator = ((negative_p = (n < (type)0)) ? ((type)(-(stype)n)) : n); \ do \ { \ (*end_digits++) = (accumulator & BIGNUM_DIGIT_MASK); \ @@ -360,13 +360,13 @@ bignum * factor_vm::name##_to_bignum(type n) \ } \ } -FOO_TO_BIGNUM(cell,cell,cell) -FOO_TO_BIGNUM(fixnum,fixnum,cell) -FOO_TO_BIGNUM(long_long,s64,u64) -FOO_TO_BIGNUM(ulong_long,u64,u64) +FOO_TO_BIGNUM(cell,cell,fixnum,cell) +FOO_TO_BIGNUM(fixnum,fixnum,fixnum,cell) +FOO_TO_BIGNUM(long_long,s64,s64,u64) +FOO_TO_BIGNUM(ulong_long,u64,s64,u64) /* cannot allocate memory */ -#define BIGNUM_TO_FOO(name,type,utype) \ +#define BIGNUM_TO_FOO(name,type,stype,utype) \ type factor_vm::bignum_to_##name(bignum * bignum) \ { \ if (BIGNUM_ZERO_P (bignum)) \ @@ -377,14 +377,14 @@ FOO_TO_BIGNUM(ulong_long,u64,u64) bignum_digit_type * scan = (start + (BIGNUM_LENGTH (bignum))); \ while (start < scan) \ accumulator = ((accumulator << BIGNUM_DIGIT_LENGTH) + (*--scan)); \ - return ((BIGNUM_NEGATIVE_P (bignum)) ? (-((type)accumulator)) : accumulator); \ + return ((BIGNUM_NEGATIVE_P (bignum)) ? ((type)(-(stype)accumulator)) : accumulator); \ } \ } -BIGNUM_TO_FOO(cell,cell,cell); -BIGNUM_TO_FOO(fixnum,fixnum,cell); -BIGNUM_TO_FOO(long_long,s64,u64) -BIGNUM_TO_FOO(ulong_long,u64,u64) +BIGNUM_TO_FOO(cell,cell,fixnum,cell); +BIGNUM_TO_FOO(fixnum,fixnum,fixnum,cell); +BIGNUM_TO_FOO(long_long,s64,s64,u64) +BIGNUM_TO_FOO(ulong_long,u64,s64,u64) double factor_vm::bignum_to_double(bignum * bignum) { diff --git a/vm/factor.cpp b/vm/factor.cpp index 60508e8a27..9c56575009 100755 --- a/vm/factor.cpp +++ b/vm/factor.cpp @@ -129,7 +129,7 @@ void factor_vm::init_factor(vm_parameters *p) init_callbacks(p->callback_size); load_image(p); init_c_io(); - init_inline_caching(p->max_pic_size); + init_inline_caching((int)p->max_pic_size); if(p->signals) init_signals();