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

Unified Diff: include/core/SkFixed.h

Issue 1022543003: replace SkFixedDiv impl with native 64bit math (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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 | « bench/MathBench.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkFixed.h
diff --git a/include/core/SkFixed.h b/include/core/SkFixed.h
index 8cf7a5679ce28358e994114204aba92162bc4332..f920fea7361b6d08312d3900e197ecdc7bfb95b9 100644
--- a/include/core/SkFixed.h
+++ b/include/core/SkFixed.h
@@ -78,7 +78,10 @@ typedef int32_t SkFixed;
#define SkFixedAbs(x) SkAbs32(x)
#define SkFixedAve(a, b) (((a) + (b)) >> 1)
-#define SkFixedDiv(numer, denom) SkDivBits(numer, denom, 16)
+static inline int32_t SkFixedDiv(int32_t numer, int32_t denom) {
+ int64_t tmp = ((int64_t)numer << 16) / denom;
+ return (int32_t)tmp;
+}
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Now look for ASM overrides for our portable versions (should consider putting this in its own file)
« no previous file with comments | « bench/MathBench.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698