aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/private/SkTLogic.h
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2016-03-18 11:53:16 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-18 11:53:17 -0700
commit89edf7a95ea694ba2c0a33adedf553c4183cdc19 (patch)
tree6dd865d3de54c759716c768ece94760a82b979a3 /include/private/SkTLogic.h
parent8bea8905e406fc1d15ef5a8294a735f3d33fb2d0 (diff)
Revert of Templatize SkToXXX. (patchset #2 id:20001 of https://codereview.chromium.org/1814153003/ )
Reason for revert: Chrome does not yet have std::underlying_type. Original issue's description: > Templatize SkToXXX. > > Makes the checked cast in debug more correct, avoiding new > warnings in vs2015. > > BUG=skia:4553 > > Committed: https://skia.googlesource.com/skia/+/0be9e806af72b3e029e691eef5c891c90d3fd320 TBR=reed@google.com,mtklein@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:4553 Review URL: https://codereview.chromium.org/1820433002
Diffstat (limited to 'include/private/SkTLogic.h')
-rw-r--r--include/private/SkTLogic.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/private/SkTLogic.h b/include/private/SkTLogic.h
index a3bc55e14e..b38fd50435 100644
--- a/include/private/SkTLogic.h
+++ b/include/private/SkTLogic.h
@@ -14,6 +14,8 @@
#ifndef SkTLogic_DEFINED
#define SkTLogic_DEFINED
+#include "SkTypes.h"
+
#include <stddef.h>
#include <stdint.h>
#include <type_traits>
@@ -40,7 +42,7 @@ template <typename T> using remove_extent_t = typename std::remove_extent<T>::ty
// On all platforms, variadic functions only exist in the c calling convention.
// mcvc 2013 introduced __vectorcall, but it wan't until 2015 that it was added to is_function.
template <typename> struct is_function : std::false_type {};
-#if !defined(WIN32)
+#if !defined(SK_BUILD_FOR_WIN)
template <typename R, typename... Args> struct is_function<R(Args...)> : std::true_type {};
#else
template <typename R, typename... Args> struct is_function<R __cdecl (Args...)> : std::true_type {};
@@ -48,7 +50,7 @@ template <typename R, typename... Args> struct is_function<R __cdecl (Args...)>
template <typename R, typename... Args> struct is_function<R __stdcall (Args...)> : std::true_type {};
template <typename R, typename... Args> struct is_function<R __fastcall (Args...)> : std::true_type {};
#endif
-#if defined(_MSC_VER) && (_M_IX86_FP >= 2 || defined(_M_AMD64) || defined(_M_X64))
+#if defined(_MSC_VER) && SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
template <typename R, typename... Args> struct is_function<R __vectorcall (Args...)> : std::true_type {};
#endif
#endif
@@ -61,7 +63,6 @@ template <typename T> using add_pointer_t = typename std::add_pointer<T>::type;
template <typename T> using add_lvalue_reference_t = typename std::add_lvalue_reference<T>::type;
template <typename... T> using common_type_t = typename std::common_type<T...>::type;
-template <typename T> using underlying_type_t = typename std::underlying_type<T>::type;
template <typename S, typename D,
bool=std::is_void<S>::value || is_function<D>::value || std::is_array<D>::value>