diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-14 11:43:52 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-14 11:43:52 +0000 |
commit | 73ab2965363713f9a0ccec3666724a60329e6ea3 (patch) | |
tree | 962e9fa0a9884c00ec2b858026c1b9c4ac9e4905 /include | |
parent | 2dc8b96230c99cd460c02fdb69b036905d072216 (diff) |
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@10705 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/config/SkUserConfig.h | 7 | ||||
-rw-r--r-- | include/core/Sk64.h | 4 | ||||
-rw-r--r-- | include/core/SkFixed.h | 57 | ||||
-rw-r--r-- | include/core/SkPostConfig.h | 11 |
4 files changed, 19 insertions, 60 deletions
diff --git a/include/config/SkUserConfig.h b/include/config/SkUserConfig.h index 236a99a03e..e78205db48 100644 --- a/include/config/SkUserConfig.h +++ b/include/config/SkUserConfig.h @@ -103,13 +103,6 @@ //#define SK_UINT8_BITFIELD_BENDIAN //#define SK_UINT8_BITFIELD_LENDIAN - -/* Some compilers don't support long long for 64bit integers. If yours does - not, define this to the appropriate type. - */ -//#define SkLONGLONG int64_t - - /* To write debug messages to a console, skia will call SkDebugf(...) following printf conventions (e.g. const char* format, ...). If you want to redirect this to something other than printf, define yours here diff --git a/include/core/Sk64.h b/include/core/Sk64.h index 6db3001fb5..47ec15e0d3 100644 --- a/include/core/Sk64.h +++ b/include/core/Sk64.h @@ -221,10 +221,6 @@ struct SK_API Sk64 { friend bool operator>=(const Sk64& a, const Sk64& b) { return a.fHi > b.fHi || (a.fHi == b.fHi && a.fLo >= b.fLo); } - -#ifdef SkLONGLONG - SkLONGLONG getLongLong() const; -#endif }; #endif diff --git a/include/core/SkFixed.h b/include/core/SkFixed.h index acfbe9af95..a4a515d30a 100644 --- a/include/core/SkFixed.h +++ b/include/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 diff --git a/include/core/SkPostConfig.h b/include/core/SkPostConfig.h index 4a819d369a..e992f42916 100644 --- a/include/core/SkPostConfig.h +++ b/include/core/SkPostConfig.h @@ -269,17 +269,6 @@ ////////////////////////////////////////////////////////////////////// -#if defined(SK_BUILD_FOR_WIN32) || defined(SK_BUILD_FOR_MAC) - #ifndef SkLONGLONG - #ifdef SK_BUILD_FOR_WIN32 - #define SkLONGLONG __int64 - #else - #define SkLONGLONG long long - #endif - #endif -#endif - -////////////////////////////////////////////////////////////////////////////////////////////// #ifndef SK_BUILD_FOR_WINCE #include <string.h> #include <stdlib.h> |