MCPcopy Create free account
hub / github.com/IoLanguage/io / UArray_removeOddIndexes

Function UArray_removeOddIndexes

libs/basekit/source/UArray_math.c:602–622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

600}
601
602void UArray_removeOddIndexes(UArray *self) {
603 size_t itemSize = self->itemSize;
604 size_t di = 1;
605 size_t si = 2;
606 size_t max = self->size;
607 uint8_t *b = self->data;
608
609 if (max == 0) {
610 return;
611 }
612
613 while (si < max) {
614 uint8_t *src = b + (si * itemSize);
615 uint8_t *dest = b + (di * itemSize);
616 memcpy(dest, src, itemSize);
617 si = si + 2;
618 di = di + 1;
619 }
620
621 UArray_setSize_(self, di);
622}
623
624void UArray_removeEvenIndexes(UArray *self) {
625 size_t itemSize = self->itemSize;

Callers

nothing calls this directly

Calls 1

UArray_setSize_Function · 0.85

Tested by

no test coverage detected