KJS::SimpleNumber on 64 bit machines
Harri Porten
porten at froglogic.com
Wed Oct 1 20:17:58 CEST 2003
Hi,
the SimpleNumber::fits() trickery causes problems on 64 bit machines. At
least on Alphas. I can reproduce a SIGFPE that happens when NaN is
passed. gcc is suspicous about the comparisons:
simple_number.h: In static member function `static bool
KJS::SimpleNumber::is(const KJS::ValueImp*)':
simple_number.h:39: warning: cast from pointer to integer of different
size
simple_number.h: In static member function `static int
KJS::SimpleNumber::value(const KJS::ValueImp*)':
simple_number.h:40: warning: cast from pointer to integer of different
size
simple_number.h:40: warning: cast from pointer to integer of different
size
simple_number.h: In static member function `static KJS::ValueImp*
KJS::SimpleNumber::make(int)':
simple_number.h:48: warning: cast to pointer from integer of different
size
I have a workaround that simply avoids letting NaN to slip through:
diff value.cpp.bak value.cpp
339c339
<
: Value(SimpleNumber::fits(d) ? SimpleNumber::make((long)d) : (KJS::isNaN(d) ? NumberImp::staticNaN
: new NumberImp(d))) { }
---
> : Value(KJS::isNaN(d) ? NumberImp::staticNaN
: (SimpleNumber::fits(d) ? SimpleNumber::make((long)d) : new
NumberImp(d))) { }
But this is probably less efficient because of the different ordering.
Anybody (maybe from Apple) could provide a suggestion or patch on how to
clean up this issue ? Any experiences from 64-bit Macs ?
Harri.
More information about the Khtml-devel
mailing list