Skip to content

Decode3 Outer Loop #6

@t-wy

Description

@t-wy
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];
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions