Skip to content

Commit b5f707f

Browse files
committed
crnlib: fix CodeQL report cpp/comparison-with-wider-type
1 parent 277eb5a commit b5f707f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

crnlib/crn_comp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ static void remap_color_endpoints(uint16* remapping, const optimize_color_params
632632
remaining[i].e = unpacked_endpoints[i];
633633
}
634634
crnlib::vector<uint16> chosen(n << 1);
635-
uint remaining_count = n, chosen_front = n, chosen_back = chosen_front;
635+
uint16 remaining_count = n, chosen_front = n, chosen_back = chosen_front;
636636
chosen[chosen_front] = selected;
637637
optimize_color_params::unpacked_endpoint front_e = remaining[selected].e, back_e = front_e;
638638
bool front_updated = true, back_updated = true;
@@ -883,7 +883,7 @@ static void remap_alpha_endpoints(uint16* remapping, const optimize_alpha_params
883883
const optimize_alpha_params::unpacked_endpoint& e_back = unpacked_endpoints[chosen.back()];
884884
uint16 selected_index = 0;
885885
uint64 best_value = 0, selected_similarity_front = 0, selected_similarity_back = 0;
886-
for (uint16 i = 0; i < remaining.size(); i++) {
886+
for (size_t i = 0; i < remaining.size(); i++) {
887887
uint remaining_index = remaining[i];
888888
const optimize_alpha_params::unpacked_endpoint& e_remaining = unpacked_endpoints[remaining_index];
889889
uint error_front = math::square(e_remaining.low - e_front.low) + math::square(e_remaining.high - e_front.high);
@@ -912,7 +912,7 @@ static void remap_alpha_endpoints(uint16* remapping, const optimize_alpha_params
912912
chosen.push_back(selected);
913913
}
914914
remaining.erase(remaining.begin() + selected_index);
915-
for (uint16 i = 0; i < remaining.size(); i++)
915+
for (size_t i = 0; i < remaining.size(); i++)
916916
total_frequency[remaining[i]] += frequency[remaining[i]];
917917
}
918918
for (uint16 i = 0; i < n; i++)

crnlib/crn_dxt_hc.cpp

Lines changed: 3 additions & 3 deletions
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)