HCADecoder icon indicating copy to clipboard operation
HCADecoder copied to clipboard

Decode3 Outer Loop

Open t-wy opened this issue 3 years ago • 0 comments

for (unsigned int i = 0; i<a; i++) {
    for (unsigned int j = 0, k = c, l = c - 1; j<b&&k<d; j++, l--) {
        block[k++] = listFloat[value3[i] - value[l]] * block[l];
    }
}

As k starts from c counting forwards, and l starts from c - 1 counting backwards, they do not overlap. So is it true that it is equivalent to setting i as only a - 1?

for (unsigned int j = 0, k = c, l = c - 1; j<b&&k<d; j++, l--) {
    block[k++] = listFloat[value3[a - 1] - value[l]] * block[l];
}

P.S. According to Deretore's Code Referencing this source, k and l are initialized in the outmost part instead, so the result should be different.

unsigned int k = c;
unsigned int l = c - 1;
for (unsigned int i = 0; i < a; i++) {
    for (unsigned int j = 0; j < b && k < d; j++, l--) {
        block[k++] = listFloat[value3[i] - value[l]] * block[l];
    }
}

From another source, it is

for (uint32 i = 0, k = c, l = c - 1; i < a; i++) {
    for (uint32 j = 0; j < b && k < d; j++, l--) {
        block[k++] = listFloat[value3[i] - value[l]] * block[l];
    }
}

t-wy avatar Jul 14 '22 19:07 t-wy