mirror of
https://github.com/woo-j/zint.git
synced 2024-12-23 01:33:55 +03:00
AZTEC: workaround MSVC optimizer deciding not to emit code for
inner top/right/bottom/left loops of `az_populate_map()` by jiggling them around a bit, ticket #317, props Andre Maute frontend/tests: clean up any directories created in `test_input()`, ticket #316, props Andre Maute
This commit is contained in:
parent
c8bb299908
commit
3960dfdbfc
@ -716,7 +716,7 @@ static int az_avoidReferenceGrid(int output) {
|
||||
|
||||
/* Calculate the position of the bits in the grid (non-compact) */
|
||||
static void az_populate_map(short AztecMap[], const int layers) {
|
||||
int layer, n, i;
|
||||
int layer;
|
||||
int x, y;
|
||||
const int offset = AztecOffset[layers - 1];
|
||||
const int endoffset = 151 - offset;
|
||||
@ -725,53 +725,50 @@ static void az_populate_map(short AztecMap[], const int layers) {
|
||||
const int start = (112 * layer) + (16 * layer * layer) + 2;
|
||||
const int length = 28 + (layer * 4) + (layer + 1) * 4;
|
||||
int av0, av1;
|
||||
int n = start, end;
|
||||
/* Top */
|
||||
i = 0;
|
||||
x = 64 - (layer * 2);
|
||||
y = 63 - (layer * 2);
|
||||
av0 = az_avoidReferenceGrid(y) * 151;
|
||||
av1 = az_avoidReferenceGrid(y - 1) * 151;
|
||||
for (n = start; n < (start + length); n += 2) {
|
||||
int avxi = az_avoidReferenceGrid(x + i);
|
||||
AztecMap[av0 + avxi] = n;
|
||||
AztecMap[av1 + avxi] = n + 1;
|
||||
i++;
|
||||
end = start + length;
|
||||
while (n < end) {
|
||||
const int avxi = az_avoidReferenceGrid(x++);
|
||||
AztecMap[av0 + avxi] = n++;
|
||||
AztecMap[av1 + avxi] = n++;
|
||||
}
|
||||
/* Right */
|
||||
i = 0;
|
||||
x = 78 + (layer * 2);
|
||||
y = 64 - (layer * 2);
|
||||
av0 = az_avoidReferenceGrid(x);
|
||||
av1 = az_avoidReferenceGrid(x + 1);
|
||||
for (n = start + length; n < (start + (length * 2)); n += 2) {
|
||||
int avyi = az_avoidReferenceGrid(y + i) * 151;
|
||||
AztecMap[avyi + av0] = n;
|
||||
AztecMap[avyi + av1] = n + 1;
|
||||
i++;
|
||||
end += length;
|
||||
while (n < end) {
|
||||
const int avyi = az_avoidReferenceGrid(y++) * 151;
|
||||
AztecMap[avyi + av0] = n++;
|
||||
AztecMap[avyi + av1] = n++;
|
||||
}
|
||||
/* Bottom */
|
||||
i = 0;
|
||||
x = 77 + (layer * 2);
|
||||
y = 78 + (layer * 2);
|
||||
av0 = az_avoidReferenceGrid(y) * 151;
|
||||
av1 = az_avoidReferenceGrid(y + 1) * 151;
|
||||
for (n = start + (length * 2); n < (start + (length * 3)); n += 2) {
|
||||
int avxi = az_avoidReferenceGrid(x - i);
|
||||
AztecMap[av0 + avxi] = n;
|
||||
AztecMap[av1 + avxi] = n + 1;
|
||||
i++;
|
||||
end += length;
|
||||
while (n < end) {
|
||||
const int avxi = az_avoidReferenceGrid(x--);
|
||||
AztecMap[av0 + avxi] = n++;
|
||||
AztecMap[av1 + avxi] = n++;
|
||||
}
|
||||
/* Left */
|
||||
i = 0;
|
||||
x = 63 - (layer * 2);
|
||||
y = 77 + (layer * 2);
|
||||
av0 = az_avoidReferenceGrid(x);
|
||||
av1 = az_avoidReferenceGrid(x - 1);
|
||||
for (n = start + (length * 3); n < (start + (length * 4)); n += 2) {
|
||||
int avyi = az_avoidReferenceGrid(y - i) * 151;
|
||||
AztecMap[avyi + av0] = n;
|
||||
AztecMap[avyi + av1] = n + 1;
|
||||
i++;
|
||||
end += length;
|
||||
while (n < end) {
|
||||
const int avyi = az_avoidReferenceGrid(y--) * 151;
|
||||
AztecMap[avyi + av0] = n++;
|
||||
AztecMap[avyi + av1] = n++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -552,6 +552,7 @@ static void test_input(const testCtx *const p_ctx) {
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int j;
|
||||
char *slash;
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
#ifdef _WIN32
|
||||
@ -591,8 +592,14 @@ static void test_input(const testCtx *const p_ctx) {
|
||||
}
|
||||
|
||||
assert_zero(testUtilRemove(input_filename), "i:%d testUtilRemove(%s) != 0 (%d: %s)\n", i, input_filename, errno, strerror(errno));
|
||||
if (data[i].batch && data[i].mirror && data[i].outfile && data[i].outfile[0] && strcmp(data[i].outfile, TEST_MIRRORED_DIR_TOO_LONG) != 0) {
|
||||
assert_zero(testUtilRmDir(data[i].outfile), "i:%d testUtilRmDir(%s) != 0 (%d: %s)\n", i, data[i].outfile, errno, strerror(errno));
|
||||
|
||||
/* Remove directory if any */
|
||||
if (data[i].outfile && (slash = strrchr(data[i].outfile, '/')) != NULL && strcmp(data[i].outfile, TEST_MIRRORED_DIR_TOO_LONG) != 0) {
|
||||
char dirpath[256];
|
||||
assert_nonzero((size_t) (slash - data[i].outfile) < sizeof(dirpath), "i: %d output directory too long\n", i);
|
||||
strncpy(dirpath, data[i].outfile, slash - data[i].outfile);
|
||||
dirpath[slash - data[i].outfile] = '\0';
|
||||
assert_zero(testUtilRmDir(dirpath), "i:%d testUtilRmDir(%s) != 0 (%d: %s)\n", i, dirpath, errno, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user