summaryrefslogtreecommitdiff
path: root/core/SkFixed.h
diff options
context:
space:
mode:
authorcommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-08-14 11:43:52 +0000
committercommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-08-14 11:43:52 +0000
commitf2946745b4554de6cdb2229f5e64d8f93873e10f (patch)
tree61e6a8ad839398174cc7cab4c483974447bfd86f /core/SkFixed.h
parent3936730ac06be4997ad4c193d1ab953d341f032d (diff)
downloadinclude-f2946745b4554de6cdb2229f5e64d8f93873e10f.tar.gz
ARM Skia NEON patches - 04 - Clean SkFixed / SkLONGLONG
It removes SkLONGLONG and uses int64_t to implement the SkFixed operations for which a SkLONGLONG version existed. It also removes the 32 bit version that are being replaced. BUG= R=djsollen@google.com, reed@google.com Author: kevin.petit.arm@gmail.com Review URL: https://chromiumcodereview.appspot.com/18539004 git-svn-id: http://skia.googlecode.com/svn/trunk/include@10705 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'core/SkFixed.h')
-rw-r--r--core/SkFixed.h57
1 files changed, 19 insertions, 38 deletions
diff --git a/core/SkFixed.h b/core/SkFixed.h
index acfbe9a..a4a515d 100644
--- a/core/SkFixed.h
+++ b/core/SkFixed.h
@@ -120,20 +120,6 @@ inline SkFixed SkFixedFraction(SkFixed x)
#define SkFixedAbs(x) SkAbs32(x)
#define SkFixedAve(a, b) (((a) + (b)) >> 1)
-SkFixed SkFixedMul_portable(SkFixed, SkFixed);
-SkFract SkFractMul_portable(SkFract, SkFract);
-inline SkFixed SkFixedSquare_portable(SkFixed value)
-{
- uint32_t a = SkAbs32(value);
- uint32_t ah = a >> 16;
- uint32_t al = a & 0xFFFF;
- SkFixed result = ah * a + al * ah + (al * al >> 16);
- if (result >= 0)
- return result;
- else // Overflow.
- return SK_FixedMax;
-}
-
#define SkFixedDiv(numer, denom) SkDivBits(numer, denom, 16)
SkFixed SkFixedDivInt(int32_t numer, int32_t denom);
SkFixed SkFixedMod(SkFixed numer, SkFixed denom);
@@ -169,27 +155,28 @@ inline bool SkFixedNearlyZero(SkFixed x, SkFixed tolerance = SK_FixedNearlyZero)
return SkAbs32(x) < tolerance;
}
+inline SkFixed SkFixedMul_longlong(SkFixed a, SkFixed b)
+{
+ return (SkFixed)((int64_t)a * b >> 16);
+}
+
+inline SkFract SkFractMul_longlong(SkFract a, SkFract b)
+{
+ return (SkFract)((int64_t)a * b >> 30);
+}
+
+inline SkFixed SkFixedSquare_longlong(SkFixed value)
+{
+ return (SkFixed)((int64_t)value * value >> 16);
+}
+
+#define SkFixedMul(a,b) SkFixedMul_longlong(a,b)
+#define SkFractMul(a,b) SkFractMul_longlong(a,b)
+#define SkFixedSquare(a) SkFixedSquare_longlong(a)
+
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Now look for ASM overrides for our portable versions (should consider putting this in its own file)
-#ifdef SkLONGLONG
- inline SkFixed SkFixedMul_longlong(SkFixed a, SkFixed b)
- {
- return (SkFixed)((SkLONGLONG)a * b >> 16);
- }
- inline SkFract SkFractMul_longlong(SkFract a, SkFract b)
- {
- return (SkFract)((SkLONGLONG)a * b >> 30);
- }
- inline SkFixed SkFixedSquare_longlong(SkFixed value)
- {
- return (SkFixed)((SkLONGLONG)value * value >> 16);
- }
- #define SkFixedMul(a,b) SkFixedMul_longlong(a,b)
- #define SkFractMul(a,b) SkFractMul_longlong(a,b)
- #define SkFixedSquare(a) SkFixedSquare_longlong(a)
-#endif
-
#if defined(SK_CPU_ARM)
/* This guy does not handle NaN or other obscurities, but is faster than
than (int)(x*65536)
@@ -262,12 +249,6 @@ inline bool SkFixedNearlyZero(SkFixed x, SkFixed tolerance = SK_FixedNearlyZero)
#ifndef SkFixedSquare
#define SkFixedSquare(x) SkFixedSquare_portable(x)
#endif
-#ifndef SkFixedMul
- #define SkFixedMul(x, y) SkFixedMul_portable(x, y)
-#endif
-#ifndef SkFractMul
- #define SkFractMul(x, y) SkFractMul_portable(x, y)
-#endif
#ifndef SkFixedMulAdd
#define SkFixedMulAdd(x, y, a) (SkFixedMul(x, y) + (a))
#endif