OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // rounding, which in turn leads to wrong results. | 47 // rounding, which in turn leads to wrong results. |
48 // An easy way to test if the floating-point operations are correct is to | 48 // An easy way to test if the floating-point operations are correct is to |
49 // evaluate: 89255.0/1e22. If the floating-point stack is 64 bits wide then | 49 // evaluate: 89255.0/1e22. If the floating-point stack is 64 bits wide then |
50 // the result is equal to 89255e-22. | 50 // the result is equal to 89255e-22. |
51 // The best way to test this, is to create a division-function and to compare | 51 // The best way to test this, is to create a division-function and to compare |
52 // the output of the division with the expected result. (Inlining must be | 52 // the output of the division with the expected result. (Inlining must be |
53 // disabled.) | 53 // disabled.) |
54 // On Linux,x86 89255e-22 != Div_double(89255.0/1e22) | 54 // On Linux,x86 89255e-22 != Div_double(89255.0/1e22) |
55 #if defined(_M_X64) || defined(__x86_64__) || \ | 55 #if defined(_M_X64) || defined(__x86_64__) || \ |
56 defined(__ARMEL__) || \ | 56 defined(__ARMEL__) || \ |
57 defined(_MIPS_ARCH_MIPS32R2) | 57 defined(_MIPS_ARCH_MIPS32) |
58 #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 | 58 #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 |
59 #elif defined(_M_IX86) || defined(__i386__) | 59 #elif defined(_M_IX86) || defined(__i386__) |
60 #if defined(_WIN32) | 60 #if defined(_WIN32) |
61 // Windows uses a 64bit wide floating point stack. | 61 // Windows uses a 64bit wide floating point stack. |
62 #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 | 62 #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 |
63 #else | 63 #else |
64 #undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS | 64 #undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS |
65 #endif // _WIN32 | 65 #endif // _WIN32 |
66 #else | 66 #else |
67 #error Target architecture was not detected as supported by Double-Conversion. | 67 #error Target architecture was not detected as supported by Double-Conversion. |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 } | 300 } |
301 | 301 |
302 template <class Dest, class Source> | 302 template <class Dest, class Source> |
303 inline Dest BitCast(Source* source) { | 303 inline Dest BitCast(Source* source) { |
304 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source)); | 304 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source)); |
305 } | 305 } |
306 | 306 |
307 } // namespace double_conversion | 307 } // namespace double_conversion |
308 | 308 |
309 #endif // DOUBLE_CONVERSION_UTILS_H_ | 309 #endif // DOUBLE_CONVERSION_UTILS_H_ |
OLD | NEW |