365 |
return nonzero_cnt; |
return nonzero_cnt; |
366 |
} |
} |
367 |
|
|
368 |
|
/* Removes N elements starting at IDX from ARRAY, which consists |
369 |
|
of COUNT elements of SIZE bytes each, by shifting the elements |
370 |
|
following them, if any, into its position. */ |
371 |
|
void |
372 |
|
remove_range (void *array_, size_t count, size_t size, |
373 |
|
size_t idx, size_t n) |
374 |
|
{ |
375 |
|
char *array = array_; |
376 |
|
|
377 |
|
assert (array != NULL); |
378 |
|
assert (idx <= count); |
379 |
|
assert (idx + n <= count); |
380 |
|
|
381 |
|
if (idx + n < count) |
382 |
|
memmove (array + idx * size, array + (idx + n) * size, |
383 |
|
size * (count - idx - n)); |
384 |
|
} |
385 |
|
|
386 |
|
/* Removes element IDX from ARRAY, which consists of COUNT |
387 |
|
elements of SIZE bytes each, by shifting the elements |
388 |
|
following it, if any, into its position. */ |
389 |
|
void |
390 |
|
remove_element (void *array, size_t count, size_t size, |
391 |
|
size_t idx) |
392 |
|
{ |
393 |
|
remove_range (array, count, size, idx, 1); |
394 |
|
} |
395 |
|
|
396 |
/* A predicate and its auxiliary data. */ |
/* A predicate and its auxiliary data. */ |
397 |
struct pred_aux |
struct pred_aux |
398 |
{ |
{ |