Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Fix warning C4723 potential divide by zero
Browse files Browse the repository at this point in the history
Appears in VS 15.8 for arm64 builds.

Fixes #19715
  • Loading branch information
BruceForstall committed Aug 28, 2018
1 parent 4a97250 commit ead7a76
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/vm/ngenhash.inl
Expand Up @@ -682,6 +682,11 @@ DWORD NgenHashTable<NGEN_HASH_ARGS>::PersistedBucketList::GetBucketSize(DWORD cE

#ifndef DACCESS_COMPILE

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4723) // Prevent "warning C4723: potential divide by 0"
#endif // _MSC_VER

// Call during ngen to save hash table data structures into the ngen image. Calls derived-class
// implementations of ShouldSave to determine which entries should be serialized, IsHotEntry to hot/cold split
// the entries and SaveEntry to allow per-entry extension of the saving process.
Expand Down Expand Up @@ -806,6 +811,7 @@ void NgenHashTable<NGEN_HASH_ARGS>::BaseSave(DataImage *pImage, CorProfileData *
// us to lay out entries into their final order using a linear algorithm in a later phase.
if (pMapEntry->m_fHot)
{
_ASSERTE(cHotBuckets != 0);
pMapEntry->m_dwNewBucket = pMapEntry->m_iHashValue % cHotBuckets;
pMapEntry->m_dwChainOrdinal = pHotBucketSizes[pMapEntry->m_dwNewBucket]++;
if (pHotBucketSizes[pMapEntry->m_dwNewBucket] > cMaxHotChain)
Expand Down Expand Up @@ -1006,6 +1012,10 @@ void NgenHashTable<NGEN_HASH_ARGS>::BaseSave(DataImage *pImage, CorProfileData *
memset(pNewBuckets, 0, cNewWarmBuckets * sizeof(VolatileEntry*));
}

#ifdef _MSC_VER
#pragma warning(pop)
#endif // _MSC_VER:

// Call during ngen to register fixups for hash table data structure fields. Calls derived-class
// implementation of FixupEntry to allow per-entry extension of the fixup process.
template <NGEN_HASH_PARAMS>
Expand Down

0 comments on commit ead7a76

Please sign in to comment.