fix: unsigned underflow on empty array
This commit is contained in:
@@ -13,6 +13,10 @@ unsigned int arr_uint_index_of(UintArray array, unsigned int value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned int arr_uint_remap_index(UintArray offsets, unsigned int *index) {
|
unsigned int arr_uint_remap_index(UintArray offsets, unsigned int *index) {
|
||||||
|
if (offsets.length == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (unsigned int i = offsets.length - 1; i > 0; i--) {
|
for (unsigned int i = offsets.length - 1; i > 0; i--) {
|
||||||
if (*index >= offsets.values[i]) {
|
if (*index >= offsets.values[i]) {
|
||||||
*index -= offsets.values[i];
|
*index -= offsets.values[i];
|
||||||
|
|||||||
Reference in New Issue
Block a user