src/array_list.c

changeset 1022
2911c1f4a570
parent 1019
09c6fe8fe3b9
child 1040
1ecf4dbbc60c
equal deleted inserted replaced
1021:1f22de6977a1 1022:2911c1f4a570
433 return size; 433 return size;
434 } else if (result == 0) { 434 } else if (result == 0) {
435 return 0; 435 return 0;
436 } 436 }
437 437
438 // special case: there is only one element and that is smaller
439 if (size == 1) return 0;
440
438 // check the last array element 441 // check the last array element
439 result = cmp_func(elem, array + elem_size * (size - 1)); 442 result = cmp_func(elem, array + elem_size * (size - 1));
440 if (result >= 0) { 443 if (result >= 0) {
441 return size - 1; 444 return size - 1;
442 } 445 }

mercurial