Suppress conversion
authorSinan Kaya <sinan.kaya@microsoft.com>
Sat, 23 Feb 2019 02:32:59 +0000 (02:32 +0000)
committerAdeel <adeelbm@outlook.com>
Sun, 24 Feb 2019 23:53:32 +0000 (15:53 -0800)
Suppress warning during hash

add casting

Commit migrated from https://github.com/dotnet/coreclr/commit/fcdfa70be9af5e7ec8133c3aaf73b142991e2bd4

src/coreclr/src/vm/crossloaderallocatorhash.inl
src/coreclr/src/vm/inlinetracking.h
src/coreclr/src/vm/rejit.h
src/coreclr/src/zap/zapimport.cpp
src/coreclr/src/zap/zapinfo.cpp
src/coreclr/src/zap/zapmetadata.h

index a12470c..539692c 100644 (file)
@@ -201,7 +201,7 @@ template <class TKey_, class TValue_>
 /*static*/ inline INT32 GCHeapHashDependentHashTrackerHashTraits::Hash(PtrTypeKey *pValue)
 {
     LIMITED_METHOD_CONTRACT;
-    return *(INT32*)pValue;
+    return (INT32)(SIZE_T)*pValue;
 }
 
 /*static*/ inline INT32 GCHeapHashDependentHashTrackerHashTraits::Hash(PTRARRAYREF arr, INT32 index)
@@ -274,7 +274,7 @@ template <class TKey>
 /*static*/ INT32 KeyToValuesGCHeapHashTraits<TRAITS>::Hash(TKey *pValue)
 {
     LIMITED_METHOD_CONTRACT;
-    return (INT32)(DWORD)*pValue;
+    return (INT32)(DWORD_PTR)*pValue;
 }
 
 template<class TRAITS>
index 58336a4..e885f1b 100644 (file)
@@ -106,7 +106,7 @@ public:
     static count_t Hash(key_t k)
     {
         LIMITED_METHOD_DAC_CONTRACT;
-        return k.m_methodDef ^ *(count_t*)k.m_module;
+        return ((count_t)k.m_methodDef ^ (count_t)(SIZE_T)k.m_module);
     }
     static const element_t Null()
     {
index 09513e1..7dce99d 100644 (file)
@@ -150,7 +150,7 @@ private:
         typedef CodeVersionManager * key_t;
         static key_t GetKey(const element_t &e) { return e->m_pCodeVersionManager; }
         static BOOL Equals(key_t k1, key_t k2) { return (k1 == k2); }
-        static count_t Hash(key_t k) { return *(count_t*)k; }
+        static count_t Hash(key_t k) { return (count_t)(SIZE_T)k; }
         static bool IsNull(const element_t &e) { return (e == NULL); }
     };
 
index 9d8eec1..8879964 100644 (file)
@@ -1674,7 +1674,7 @@ public:
 
     CORCOMPILE_FIXUP_BLOB_KIND GetKind()
     {
-        int kind = (int)GetHandle();
+        int kind = (int)(SIZE_T)GetHandle();
 
         if ((kind & 1) == 1)
         {
index 8a37282..ccb796d 100644 (file)
@@ -734,7 +734,7 @@ COUNT_T ZapImage::MethodCodeTraits::Hash(key_t k)
             case ZapNodeType_Import_ClassHandle:
             case ZapNodeType_MethodHandle:
             case ZapNodeType_Import_MethodHandle:
-                hash = ((hash << 5) + hash) ^ (COUNT_T)(pTarget);
+                hash = ((hash << 5) + hash) ^ (COUNT_T)((SIZE_T)pTarget);
                 break;
             default:
                 break;
index 5ef6bd4..358db8e 100644 (file)
@@ -209,7 +209,7 @@ private:
         static count_t Hash(key_t k) 
         {
             LIMITED_METHOD_CONTRACT;
-            return (count_t)k;
+            return (count_t)(SIZE_T)k;
         }
 
         static element_t Null() { LIMITED_METHOD_CONTRACT; return NULL; }