Chromium Code Reviews| Index: src/platform-win32.cc |
| diff --git a/src/platform-win32.cc b/src/platform-win32.cc |
| index 49463be8e00fbf8ab022e71ba8af5fccaf0f2f09..2defae5ed3fe77b01d8b09f3b80d357210d9717d 100644 |
| --- a/src/platform-win32.cc |
| +++ b/src/platform-win32.cc |
| @@ -44,6 +44,19 @@ int strncasecmp(const char* s1, const char* s2, int n) { |
| return _strnicmp(s1, s2, n); |
| } |
| +inline int lrint(double flt) { |
| + int intgr; |
| +#if defined(V8_TARGET_ARCH_IA32) || defined(V8_TARGET_ARCH_X64) |
| + __asm { |
| + fld flt |
| + fistp intgr |
| + }; |
| +#else |
| +#pragma message("Falling back to casting for lrint().") |
| + intgr = static_cast<int>(flt + 0.5); |
| +#endif |
| + return intgr; |
| +} |
|
Yang
2012/08/22 07:57:07
Maybe it's better to throw a compile error here in
ulan
2012/08/22 13:48:17
I moved it to the header file and implemented the
|
| #endif // _MSC_VER |