Skip to content

Commit 52ac792

Browse files
committed
crnlib: fix CodeQL report cpp/comparison-with-wider-type
1 parent 5abcc45 commit 52ac792

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

crnlib/crn_comp.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ static void remap_color_endpoints(uint16* remapping, const optimize_color_params
639639
remaining[i].e = unpacked_endpoints[i];
640640
}
641641
crnlib::vector<uint16> chosen(n << 1);
642-
uint remaining_count = n, chosen_front = n, chosen_back = chosen_front;
642+
uint16 remaining_count = n, chosen_front = n, chosen_back = chosen_front;
643643
chosen[chosen_front] = selected;
644644
optimize_color_params::unpacked_endpoint front_e = remaining[selected].e, back_e = front_e;
645645
bool front_updated = true, back_updated = true;
@@ -665,7 +665,7 @@ static void remap_color_endpoints(uint16* remapping, const optimize_color_params
665665
}
666666
frequency = hist + selected * n;
667667
uint frequency_front = 0, frequency_back = 0;
668-
for (int front = chosen_front, back = chosen_back, scale = back - front; scale > 0; front++, back--, scale -= 2) {
668+
for (uint16 front = chosen_front, back = chosen_back, scale = back - front; scale > 0; front++, back--, scale -= 2) {
669669
frequency_front += scale * frequency[chosen[front]];
670670
frequency_back += scale * frequency[chosen[back]];
671671
}

crnlib/crn_dxt_hc.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,10 @@ void dxt_hc::determine_tiles_task(uint64 data, void*) {
374374
}
375375
}
376376

377-
for (uint8 c = m_has_color_blocks ? 0 : cAlpha0; c < cAlpha0 + m_num_alpha_blocks; c++) {
378-
for (uint8 e = 0; e < 8; e++) {
377+
for (uint c = m_has_color_blocks ? 0 : cAlpha0; c < cAlpha0 + m_num_alpha_blocks; c++) {
378+
for (uint e = 0; e < 8; e++) {
379379
total_error[c][e] = 0;
380-
for (uint8 t = 0, s = e + 1; s; s >>= 1, t++)
380+
for (uint t = 0, s = e + 1; s; s >>= 1, t++)
381381
total_error[c][e] += tile_error[c][tiles[e][t]];
382382
}
383383
}

0 commit comments

Comments
 (0)