diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkMath.h | 2 | ||||
-rw-r--r-- | include/gpu/GrConfig.h | 16 | ||||
-rw-r--r-- | include/private/SkFloatingPoint.h | 28 |
3 files changed, 4 insertions, 42 deletions
diff --git a/include/core/SkMath.h b/include/core/SkMath.h index e5069592d0..abb685f6da 100644 --- a/include/core/SkMath.h +++ b/include/core/SkMath.h @@ -72,7 +72,7 @@ int32_t SkSqrtBits(int32_t value, int bitBias); int SkCLZ_portable(uint32_t); #ifndef SkCLZ - #if defined(_MSC_VER) && _MSC_VER >= 1400 + #if defined(_MSC_VER) #include <intrin.h> static inline int SkCLZ(uint32_t mask) { diff --git a/include/gpu/GrConfig.h b/include/gpu/GrConfig.h index bb653b6a7d..8e0efbd472 100644 --- a/include/gpu/GrConfig.h +++ b/include/gpu/GrConfig.h @@ -106,7 +106,7 @@ typedef unsigned __int64 uint64_t; * particular compiler. * To insert compiler warnings use "#pragma message GR_WARN(<string>)" */ -#if defined(_MSC_VER) && _MSC_VER +#if defined(_MSC_VER) #define GR_WARN(MSG) (GR_FILE_AND_LINE_STR "WARNING: " MSG) #else//__GNUC__ - may need other defines for different compilers #define GR_WARN(MSG) ("WARNING: " MSG) @@ -171,19 +171,7 @@ typedef unsigned __int64 uint64_t; * it may print the message in the compiler log. Obviously, the condition must * be evaluatable at compile time. */ -// VS 2010 and GCC compiled with c++0x or gnu++0x support the new -// static_assert. -#if !defined(GR_STATIC_ASSERT) - #if (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__) - #define GR_STATIC_ASSERT(CONDITION) static_assert(CONDITION, "bug") - #else - template <bool> class GR_STATIC_ASSERT_FAILURE; - template <> class GR_STATIC_ASSERT_FAILURE<true> {}; - #define GR_STATIC_ASSERT(CONDITION) \ - enum {GR_CONCAT(X,__LINE__) = \ - sizeof(GR_STATIC_ASSERT_FAILURE<CONDITION>)} - #endif -#endif +#define GR_STATIC_ASSERT(CONDITION) static_assert(CONDITION, "bug") /** * Set to 1 to enable pixel local storage path rendering on supported devices. diff --git a/include/private/SkFloatingPoint.h b/include/private/SkFloatingPoint.h index ffed5c0747..efaf4109f1 100644 --- a/include/private/SkFloatingPoint.h +++ b/include/private/SkFloatingPoint.h @@ -29,33 +29,6 @@ static inline float sk_float_pow(float base, float exp) { return powf(base, exp); } -static inline float sk_float_copysign(float x, float y) { -// c++11 contains a 'float copysign(float, float)' function in <cmath>. -// clang-cl reports __cplusplus for clang, not the __cplusplus vc++ version _MSC_VER would report. -#if (defined(_MSC_VER) && defined(__clang__)) -# define SK_BUILD_WITH_CLANG_CL 1 -#else -# define SK_BUILD_WITH_CLANG_CL 0 -#endif -#if (!SK_BUILD_WITH_CLANG_CL && __cplusplus >= 201103L) || (_MSC_VER >= 1800) - return copysignf(x, y); - -// Posix has demanded 'float copysignf(float, float)' (from C99) since Issue 6. -#elif defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L - return copysignf(x, y); - -// Visual studio prior to 13 only has 'double _copysign(double, double)'. -#elif defined(_MSC_VER) - return (float)_copysign(x, y); - -// Otherwise convert to bits and extract sign. -#else - int32_t xbits = SkFloat2Bits(x); - int32_t ybits = SkFloat2Bits(y); - return SkBits2Float((xbits & 0x7FFFFFFF) | (ybits & 0x80000000)); -#endif -} - #define sk_float_sqrt(x) sqrtf(x) #define sk_float_sin(x) sinf(x) #define sk_float_cos(x) cosf(x) @@ -71,6 +44,7 @@ static inline float sk_float_copysign(float x, float y) { #endif #define sk_float_atan2(y,x) atan2f(y,x) #define sk_float_abs(x) fabsf(x) +#define sk_float_copysign(x, y) copysignf(x, y) #define sk_float_mod(x,y) fmodf(x,y) #define sk_float_exp(x) expf(x) #define sk_float_log(x) logf(x) |