コード例 #1
0
        public static unsafe int GetHashCode(Object o)
        {
#if FEATURE_SYNCTABLE
            return(ObjectHeader.GetHashCode(o));
#else
            if (o == null)
            {
                return(0);

                fixed(IntPtr *pEEType = &o.m_pEEType)
                {
                    int *pSyncBlockIndex = (int *)((byte *)pEEType - 4); // skipping exactly 4 bytes for the SyncTableEntry (exactly 4 bytes not a pointer size).
                    int  hash            = *pSyncBlockIndex & MASK_HASHCODE;

                    if (hash == 0)
                    {
                        return(MakeHashCode(o, pSyncBlockIndex));
                    }
                    else
                    {
                        return(hash);
                    }
                }
#endif
        }
コード例 #2
0
 public static unsafe int GetHashCode(object o)
 {
     return(ObjectHeader.GetHashCode(o));
 }