diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-12 21:01:41 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-12 21:01:41 +0000 |
commit | 52e935d04c59135739c3a68fb6e19d313dc6d5ad (patch) | |
tree | 95f7ab178b045bef4456cbf92c6aa7e476becd99 /skia/corecg/SkFloatBits.h | |
parent | 30fab79877b4bb067944b74d98346ac9bb6bfc7e (diff) | |
download | chromium_src-52e935d04c59135739c3a68fb6e19d313dc6d5ad.zip chromium_src-52e935d04c59135739c3a68fb6e19d313dc6d5ad.tar.gz chromium_src-52e935d04c59135739c3a68fb6e19d313dc6d5ad.tar.bz2 |
New drop of Skia. This is up to CL 121320.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6925 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/corecg/SkFloatBits.h')
-rw-r--r-- | skia/corecg/SkFloatBits.h | 45 |
1 files changed, 2 insertions, 43 deletions
diff --git a/skia/corecg/SkFloatBits.h b/skia/corecg/SkFloatBits.h index 012770a..a1f67d8 100644 --- a/skia/corecg/SkFloatBits.h +++ b/skia/corecg/SkFloatBits.h @@ -1,43 +1,2 @@ -#ifndef SkFloatBits_DEFINED -#define SkFloatBits_DEFINED - -#include "SkTypes.h" - -/** Convert a sign-bit int (i.e. float interpreted as int) into a 2s compliement - int. This also converts -0 (0x80000000) to 0. Doing this to a float allows - it to be compared using normal C operators (<, <=, etc.) -*/ -static inline int32_t SkSignBitTo2sCompliment(int32_t x) { - if (x < 0) { - x &= 0x7FFFFFFF; - x = -x; - } - return x; -} - -#ifdef SK_CAN_USE_FLOAT - -union SkFloatIntUnion { - float fFloat; - int32_t fSignBitInt; -}; - -/** Return the float as a 2s compliment int. Just just be used to compare floats - to each other or against positive float-bit-constants (like 0) -*/ -static int32_t SkFloatAsInt(float x) { - SkFloatIntUnion data; - data.fFloat = x; - return SkSignBitTo2sCompliment(data.fSignBitInt); -} - -#endif - -#ifdef SK_SCALAR_IS_FLOAT - #define SkScalarAsInt(x) SkFloatAsInt(x) -#else - #define SkScalarAsInt(x) (x) -#endif - -#endif - +// TODO(brettw) remove this file! +#include "../include/corecg/SkFloatBits.h" |