Changeset 18656 in webkit for trunk/JavaScriptCore
- Timestamp:
- Jan 7, 2007, 9:08:17 PM (18 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r18584 r18656 1 2007-01-07 David Carson <[email protected]> 2 3 Reviewed by Darin. 4 5 Fix http://bugs.webkit.org/show_bug.cgi?id=11431 6 ARM platform has some byte alignment issues 7 8 Fix for NaN being 4 bytes and it must start on a byte boundary 9 for ARM architectures. 10 11 * kjs/fpconst.cpp: 12 (KJS::): 13 1 14 2007-01-04 David Kilzer <[email protected]> 2 15 -
trunk/JavaScriptCore/kjs/fpconst.cpp
r13092 r18656 47 47 #else // !PLATFORM(DARWIN) 48 48 49 // Note, we have to use union to ensure alignment. Otherwise, NaN_Bytes can start anywhere, 50 // while NaN_double has to be 4-byte aligned for 32-bits. 51 // With -fstrict-aliasing enabled, unions are the only safe way to do type masquerading. 52 53 static const union { 54 struct { 55 unsigned char NaN_Bytes[8]; 56 unsigned char Inf_Bytes[8]; 57 } bytes; 58 59 struct { 60 double NaN_Double; 61 double Inf_Double; 62 } doubles; 63 64 } NaNInf = { { 49 65 #if PLATFORM(BIG_ENDIAN) 50 const unsigned char NaN_Bytes[] = { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 };51 const unsigned char Inf_Bytes[] = { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 };66 { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 }, 67 { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } 52 68 #elif PLATFORM(MIDDLE_ENDIAN) 53 const unsigned char NaN_Bytes[] = { 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 };54 const unsigned char Inf_Bytes[] = { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 };69 { 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 }, 70 { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 } 55 71 #else 56 const unsigned char NaN_Bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f };57 const unsigned char Inf_Bytes[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f };72 { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }, 73 { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } 58 74 #endif 59 extern const double NaN = *(const double*) NaN_Bytes; 60 extern const double Inf = *(const double*) Inf_Bytes; 75 } } ; 76 77 extern const double NaN = NaNInf.doubles.NaN_Double; 78 extern const double Inf = NaNInf.doubles.Inf_Double; 61 79 62 80 #endif // !PLATFORM(DARWIN)
Note:
See TracChangeset
for help on using the changeset viewer.