Skip to content

Commit e9b6aa2

Browse files
damyanpCopilot
andcommitted
Fix signed/unsigned mismatch in LinAlgTests.cpp
Change loop variables from int32_t to size_t to match the NumElements parameter type (size_t), fixing C4018 warnings treated as errors in x86 builds. Co-authored-by: Copilot <[email protected]>
1 parent 475e3cc commit e9b6aa2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tools/clang/unittests/HLSLExec/LinAlgTests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,21 +226,21 @@ static VariantCompType makeExpected(ComponentType CompType, size_t NumElements,
226226
switch (CompType) {
227227
case ComponentType::F32: {
228228
std::vector<float> Floats(NumElements);
229-
for (int32_t I = 0; I < NumElements; I++)
229+
for (size_t I = 0; I < NumElements; I++)
230230
Floats[I] = StartingVal + static_cast<float>(Increment ? I : 0);
231231
return Floats;
232232
}
233233
case ComponentType::I32: {
234234
DXASSERT(StartingVal < static_cast<float>(INT_MAX),
235235
"Value too large to cast to int32_t");
236236
std::vector<int32_t> Ints(NumElements);
237-
for (int32_t I = 0; I < NumElements; I++)
238-
Ints[I] = static_cast<int32_t>(StartingVal) + (Increment ? I : 0);
237+
for (size_t I = 0; I < NumElements; I++)
238+
Ints[I] = static_cast<int32_t>(StartingVal) + static_cast<int32_t>(Increment ? I : 0);
239239
return Ints;
240240
}
241241
case ComponentType::F16: {
242242
std::vector<HLSLHalf_t> Halfs(NumElements);
243-
for (int32_t I = 0; I < NumElements; I++) {
243+
for (size_t I = 0; I < NumElements; I++) {
244244
// Downcasting is safe here since HLSLHalf_t will clamp if F is too large.
245245
float F = StartingVal + static_cast<float>(Increment ? I : 0);
246246
Halfs[I] = HLSLHalf_t(F);

0 commit comments

Comments
 (0)