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

Unified Diff: src/conversions.h

Issue 1128010: Modify FastD2I to use static_cast instead of lrint(). Benchmarks show that it... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 9 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
« no previous file with comments | « no previous file | src/conversions-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/conversions.h
===================================================================
--- src/conversions.h (revision 4210)
+++ src/conversions.h (working copy)
@@ -36,7 +36,12 @@
// rounding towards zero.
// The result is unspecified if x is infinite or NaN, or if the rounded
// integer value is outside the range of type int.
-static inline int FastD2I(double x);
+static inline int FastD2I(double x) {
+ // The static_cast convertion from double to int used to be slow, but
+ // as new benchmarks show, now it is much faster than lrint().
+ return static_cast<int>(x);
+}
+
static inline unsigned int FastD2UI(double x);
« no previous file with comments | « no previous file | src/conversions-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698