[GiNaC-list] Possible size issue in test in numeric.cpp

Jens Vollinga vollinga at physik.uni-wuppertal.de
Wed Aug 16 17:23:37 CEST 2006

Dear Pierangelo,

Pierangelo Masarati schrieb:
> Jens Vollinga writes:
>> @Richy:
>> You wondered why the other ctor for unsigned int doesn't raise such a 
>> warning. After looking at the code I now wonder whether the code there 
>> is optimal. The argument is compared against 2^(cl_value_len-1) and 
>> not 2^(cl_value_len)-1 as one might expect. Maybe this should be 
>> changed? Could you comment on this soon, because I'd like to roll the 
>> release this evening?
> I agree it should be
>       i < ((1UL << cl_value_len)-1)

well, I have to correct myself: it should be
        i < (1UL << cl_value_len)
I guess.

> In this case, a fix similar to the "int" case on 64 bit architectires 
> would apply, since a "unsigned" will always be less than 2^32.  A patch 
> is available at
> <http://mbdyn.aero.polimi.it/~masarati/Download/mbdyn/ginac-numeric-uint.pat 
> ch>

thanks, but I've already done that :-)

But still I want to wait for Richy's response before I put it in CVS, 
because it could be that CLN uses a signed data representation for small 
integers internally (crazy idea, but conceivable ... ;-)) so that the 
original if clause might be correct.


More information about the GiNaC-list mailing list