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

Function UArray_addEqualsOffsetXScaleYScale

libs/basekit/source/UArray_math.c:666–699  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

664
665//
666void UArray_addEqualsOffsetXScaleYScale(UArray *self, UArray *other,
667 float offset, float xscale,
668 float yscale) {
669 if (self->itemType == CTYPE_float32_t &&
670 other->itemType == CTYPE_float32_t) {
671 float32_t *d1 = (float32_t *)self->data;
672 float32_t *d2 = (float32_t *)other->data;
673
674 long i = offset;
675 long j = 0;
676
677 while (i < (long)self->size) {
678 size_t jj = j / xscale;
679
680 // printf("self->size: %i i: %i jj: %i\n", self->size, i, jj);
681 if (jj > other->size - 1)
682 break;
683
684 if (i >= 0) //&& jj < other->size - 1)
685 {
686 d1[i] += d2[jj] * yscale;
687 }
688
689 j++;
690 i++;
691 }
692
693 UArray_changed(self);
694 } else {
695 printf(
696 "UArray_addEqualsOffsetXScaleYScale called on non float array\n");
697 exit(-1);
698 }
699}

Callers 1

IoSeq_mutable.cFile · 0.85

Calls 1

UArray_changedFunction · 0.85

Tested by

no test coverage detected