Bug #13

Bignum warnings

Added by Daniel Berger 872 days ago.

Status:New Start:03/09/2008
Priority:Low Due date:
Assigned to:- % Done:

0%

Category:Core Class Spent time: -
Target version:-

Description

These show up on MS Windows with -W3:

bignum.c(105) : warning C4244: '=' : conversion from 'unsigned __int64' to 'long', possible loss of data
bignum.c(817) : warning C4244: 'return' : conversion from 'unsigned __int64' to 'unsigned long', possible loss of data
bignum.c(825) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
bignum.c(838) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
bignum.c(884) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
bignum.c(1333) : warning C4244: '=' : conversion from 'unsigned __int64' to 'unsigned int', possible loss of data
bignum.c(2262) : warning C4244: '=' : conversion from 'double' to 'unsigned int', possible loss of data
bignum.c(2265) : warning C4244: '=' : conversion from 'double' to 'unsigned int', possible loss of data

The warnings about unary minus are troublesome, because we have to figure out the intent of the function in terms of what it's supposed to do and what it should return.

History

Updated by Park Heesob 872 days ago

In Ruby, Bignum is just Bignum. There is no signed Bignum and unsigned Bignum.
How about remove conversion of Bignum to unsigned data type like unsigned int, ungined long
and unsigned long long?
This might be some waste of memory. But I think it gets results of better performance.

As you know, Java does not have unsigned type.
Refer to http://www.darksleep.com/player/JavaAndUnsignedTypes.html

Updated by Daniel Berger 871 days ago

That sounds reasonable to me, but I have a feeling I'm missing something. I'm not sure how robust my Bignum tests are, either.

However, patches and benchmarks welcome. :)

Also available in: Atom PDF