Simplified C code to eliminate a loop variable.

This commit is contained in:
Project Nayuki 2018-08-28 05:08:27 +00:00
parent de2603ab5f
commit 08f7bba796
1 changed files with 2 additions and 3 deletions

View File

@ -209,10 +209,9 @@ testable void addEccAndInterleave(uint8_t data[], int version, enum qrcodegen_Ec
// Split data into blocks and append ECC after all data
uint8_t generator[qrcodegen_REED_SOLOMON_DEGREE_MAX];
calcReedSolomonGenerator(blockEccLen, generator);
for (int i = 0, j = dataLen, k = 0; i < numBlocks; i++) {
for (int i = 0, k = 0; i < numBlocks; i++) {
int blockLen = shortBlockDataLen + (i < numShortBlocks ? 0 : 1);
calcReedSolomonRemainder(&data[k], blockLen, generator, blockEccLen, &data[j]);
j += blockEccLen;
calcReedSolomonRemainder(&data[k], blockLen, generator, blockEccLen, &data[dataLen + i * blockEccLen]);
k += blockLen;
}