Skip to content

Commit 0e101ff

Browse files
mateuszchudykigcbot
authored andcommitted
Use std::size instead of dividing sizeofs
Use std::size instead of dividing sizeofs
1 parent 82e528f commit 0e101ff

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

IGC/AdaptorOCL/dllInterfaceCompute.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ bool TranslateBuildSPMD(
11761176
if (instCombineSinkingSwitch->getValue()->getNumOccurrences() == 0)
11771177
{
11781178
const char* const args[] = { "igc", instCombineFlag.data() };
1179-
llvm::cl::ParseCommandLineOptions(sizeof(args) / sizeof(args[0]), args);
1179+
llvm::cl::ParseCommandLineOptions(std::size(args), args);
11801180
}
11811181
}
11821182
}
@@ -1829,9 +1829,7 @@ static constexpr STB_TranslationCode g_cICBETranslationCodes[] =
18291829
TRANSLATION_BLOCK_API void Register(STB_RegisterArgs* pRegisterArgs)
18301830
{
18311831
pRegisterArgs->Version = TC::STB_VERSION;
1832-
pRegisterArgs->NumTranslationCodes =
1833-
sizeof(g_cICBETranslationCodes) /
1834-
sizeof(g_cICBETranslationCodes[0]);
1832+
pRegisterArgs->NumTranslationCodes = std::size(g_cICBETranslationCodes);
18351833

18361834
if (pRegisterArgs->pTranslationCodes)
18371835
{

IGC/OCLFE/igd_fcl_mcl/source/clang_tb.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,7 +1980,7 @@ namespace TC
19801980
}
19811981

19821982
unsigned int i;
1983-
for (i = 0; i < sizeof(g_cClangTranslationCodes) / sizeof(g_cClangTranslationCodes[0]); i++)
1983+
for (i = 0; i < std::size(g_cClangTranslationCodes); i++)
19841984
{
19851985
// Some quick checks to ensure that the input and output types
19861986
// are compatible with this translation blocks
@@ -1991,7 +1991,7 @@ namespace TC
19911991
}
19921992
}
19931993

1994-
if (i >= sizeof(g_cClangTranslationCodes) / sizeof(g_cClangTranslationCodes[0]))
1994+
if (i >= std::size(g_cClangTranslationCodes))
19951995
{
19961996
return false;
19971997
}

0 commit comments

Comments
 (0)