Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Unified Diff: sky/engine/wtf/HashFunctions.h

Issue 719063002: Revert "Remove support for MSVC" (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/engine/wtf/HashFunctions.h
diff --git a/sky/engine/wtf/HashFunctions.h b/sky/engine/wtf/HashFunctions.h
index f0b2fbbbfb81ab2d03a83a2c3083011b04db01f7..522bfd776bb8814e37d6574b3229618097048ef9 100644
--- a/sky/engine/wtf/HashFunctions.h
+++ b/sky/engine/wtf/HashFunctions.h
@@ -124,7 +124,14 @@ namespace WTF {
template<typename T> struct PtrHash {
static unsigned hash(T key)
{
+#if COMPILER(MSVC)
+#pragma warning(push)
+#pragma warning(disable: 4244) // work around what seems to be a bug in MSVC's conversion warnings
+#endif
return IntHash<uintptr_t>::hash(reinterpret_cast<uintptr_t>(key));
+#if COMPILER(MSVC)
+#pragma warning(pop)
+#endif
}
static bool equal(T a, T b) { return a == b; }
static bool equal(std::nullptr_t, T b) { return b == 0; }
@@ -198,7 +205,11 @@ namespace WTF {
template<> struct DefaultHash<unsigned long> { typedef IntHash<unsigned long> Hash; };
template<> struct DefaultHash<long long> { typedef IntHash<unsigned long long> Hash; };
template<> struct DefaultHash<unsigned long long> { typedef IntHash<unsigned long long> Hash; };
+
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
template<> struct DefaultHash<wchar_t> { typedef IntHash<wchar_t> Hash; };
+#endif
+
template<> struct DefaultHash<float> { typedef FloatHash<float> Hash; };
template<> struct DefaultHash<double> { typedef FloatHash<double> Hash; };

Powered by Google App Engine
This is Rietveld 408576698