Skip to content

Commit f17007d

Browse files
committed
Add some loop count promises
1 parent 5cd89c3 commit f17007d

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

Source/astcenc_integer_sequence.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,8 @@ void encode_ise(
481481
uint8_t* output_data,
482482
int bit_offset
483483
) {
484+
promise(elements > 0);
485+
484486
int bits = btq_counts[quant_level].bits;
485487
int trits = btq_counts[quant_level].trits;
486488
int quints = btq_counts[quant_level].quints;
@@ -637,6 +639,8 @@ void decode_ise(
637639
uint8_t* output_data,
638640
int bit_offset
639641
) {
642+
promise(elements > 0);
643+
640644
// note: due to how the trit/quint-block unpacking is done in this function,
641645
// we may write more temporary results than the number of outputs
642646
// The maximum actual number of results is 64 bit, but we keep 4 additional elements

Source/astcenc_pick_best_endpoint_format.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,9 @@ void determine_optimal_set_of_endpoint_formats_to_use(
790790
) {
791791
int partition_count = pt->partition_count;
792792

793+
promise(partition_count > 0);
794+
promise(bsd->block_mode_count > 0);
795+
793796
int encode_hdr_rgb = blk->rgb_lns[0];
794797
int encode_hdr_alpha = blk->alpha_lns[0];
795798

0 commit comments

Comments
 (0)