[webkit-changes] cvs commit: JavaScriptCore/kjs simple_number.h
Geoffrey
ggaren at opensource.apple.com
Mon Sep 19 14:53:22 PDT 2005
ggaren 05/09/19 14:53:22
Modified: . ChangeLog
kjs simple_number.h
Log:
- Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5028
9 layout tests fail following the change from long to int
- Rolled out changes to simple_number.h, and added fits(long long)
and SimpleNumber::fits(unsigned long long) to the old system.
Reviewed by mjs.
* kjs/simple_number.h:
(KJS::SimpleNumber::):
(KJS::SimpleNumber::value):
(KJS::SimpleNumber::fits):
(KJS::SimpleNumber::integerFits):
(KJS::SimpleNumber::make):
Revision Changes Path
1.828 +17 -0 JavaScriptCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
retrieving revision 1.827
retrieving revision 1.828
diff -u -r1.827 -r1.828
--- ChangeLog 19 Sep 2005 06:57:24 -0000 1.827
+++ ChangeLog 19 Sep 2005 21:53:21 -0000 1.828
@@ -1,3 +1,20 @@
+2005-09-19 Geoffrey Garen <ggaren at apple.com>
+
+ - Fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5028
+ 9 layout tests fail following the change from long to int
+
+ - Rolled out changes to simple_number.h, and added fits(long long)
+ and SimpleNumber::fits(unsigned long long) to the old system.
+
+ Reviewed by mjs.
+
+ * kjs/simple_number.h:
+ (KJS::SimpleNumber::):
+ (KJS::SimpleNumber::value):
+ (KJS::SimpleNumber::fits):
+ (KJS::SimpleNumber::integerFits):
+ (KJS::SimpleNumber::make):
+
2005-09-14 Maciej Stachowiak <mjs at apple.com>
Reviewed by Geoff.
1.16 +12 -23 JavaScriptCore/kjs/simple_number.h
Index: simple_number.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/simple_number.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- simple_number.h 16 Sep 2005 22:42:30 -0000 1.15
+++ simple_number.h 19 Sep 2005 21:53:22 -0000 1.16
@@ -36,8 +36,6 @@
using std::signbit;
#endif
-#define KJS_MIN_MACRO(a, b) ((a) < (b) ? (a) : (b))
-
namespace KJS {
class ValueImp;
@@ -53,29 +51,20 @@
class SimpleNumber {
public:
- enum {
- tag = 1,
- shift = 2,
- mask = (1 << shift) - 1,
- bits = KJS_MIN_MACRO(sizeof(ValueImp *) * 8 - shift, sizeof(long) * 8),
- sign = 1UL << (bits + shift - 1),
- umax = sign >> 1,
- smax = static_cast<long>(umax),
- smin = static_cast<long>(-umax - 1)
- };
-
+ enum { tag = 1, shift = 2, mask = (1 << shift) - 1, sign = 1L << (sizeof(long) * 8 - 1 ), max = (1L << ((sizeof(long) * 8 - 1) - shift)) - 1, min = -max - 1, imax = (1L << ((sizeof(int) * 8 - 1) - shift)) - 1, imin = -imax - 1 };
+
static inline bool is(const ValueImp *imp) { return ((long)imp & mask) == tag; }
- static inline long value(const ValueImp *imp) { return ((long)imp >> shift) | (((long)imp & sign) ? ~umax : 0); }
+ static inline long value(const ValueImp *imp) { return ((long)imp >> shift) | (((long)imp & sign) ? ~max : 0); }
- static inline bool fits(int i) { return i <= smax && i >= smin; }
- static inline bool fits(unsigned i) { return i <= umax; }
- static inline bool fits(long i) { return i <= smax && i >= smin; }
- static inline bool fits(unsigned long i) { return i <= umax; }
- static inline bool fits(long long i) { return i <= smax && i >= smin; }
- static inline bool fits(unsigned long long i) { return i <= umax; }
- static inline bool integerFits(double d) { return !(d < smin || d > smax); }
- static inline bool fits(double d) { return d >= smin && d <= smax && d == (double)(long)d && !isNegativeZero(d); }
- static inline ValueImp *make(long i) { return reinterpret_cast<ValueImp *>(static_cast<uintptr_t>((i << shift) | tag)); }
+ static inline bool fits(int i) { return i <= imax && i >= imin; }
+ static inline bool fits(unsigned i) { return i <= (unsigned)max; }
+ static inline bool fits(long i) { return i <= max && i >= min; }
+ static inline bool fits(unsigned long i) { return i <= (unsigned)max; }
+ static inline bool fits(long long i) { return i <= max && i >= min; }
+ static inline bool fits(unsigned long long i) { return i <= (unsigned)max; }
+ static inline bool integerFits(double d) { return !(d < min || d > max); }
+ static inline bool fits(double d) { return d >= min && d <= max && d == (double)(long)d && !isNegativeZero(d); }
+ static inline ValueImp *make(long i) { return (ValueImp *)((i << shift) | tag); }
};
}
More information about the webkit-changes
mailing list