Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1469)

Unified Diff: src/platform-win32.cc

Issue 10831409: Fix rounding in Uint8ClampedArray setter. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698