Skip to content

Commit c9ca417

Browse files
authored
Assert and return on divide by zero (#187)
1 parent 4c04653 commit c9ca417

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Source/GmmLib/TranslationTable/GmmAuxTable.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -938,8 +938,17 @@ GMM_GFX_ADDRESS GMM_INLINE GmmLib::AuxTable::__GetCCSCacheline(GMM_RESOURCE_INFO
938938
if(BaseIsYF)
939939
{
940940
uint32_t PitchIn4YF = BasePitchInTiles / 4; //Base Pitch is physically padded to 4x1 YF width
941-
i = static_cast<uint32_t>(AdrOffset % PitchIn4YF);
942-
j = static_cast<uint32_t>(AdrOffset / PitchIn4YF);
941+
942+
if (PitchIn4YF != 0)
943+
{
944+
i = static_cast<uint32_t>(AdrOffset % PitchIn4YF);
945+
j = static_cast<uint32_t>(AdrOffset / PitchIn4YF);
946+
}
947+
else
948+
{
949+
__GMM_ASSERT(PitchIn4YF != 0);
950+
return 0;
951+
}
943952
}
944953
else if(BasePitchInTiles != 0) //TileYs
945954
{

0 commit comments

Comments
 (0)