Updated JavaScript code for type purity to ensure the modules array is actually Boolean (instead of numeric) after masking, tweaked TypeScript code to correspond to new JS code.

pull/39/merge
Project Nayuki 6 years ago
parent 6903d28c90
commit bc6f776429

@ -398,7 +398,8 @@ var qrcodegen = new function() {
case 7: invert = ((x + y) % 2 + x * y % 3) % 2 == 0; break; case 7: invert = ((x + y) % 2 + x * y % 3) % 2 == 0; break;
default: throw "Assertion error"; default: throw "Assertion error";
} }
modules[y][x] ^= invert & !isFunction[y][x]; if (!isFunction[y][x] && invert)
modules[y][x] = !modules[y][x];
} }
} }
} }

@ -470,7 +470,7 @@ namespace qrcodegen {
case 7: invert = ((x + y) % 2 + x * y % 3) % 2 == 0; break; case 7: invert = ((x + y) % 2 + x * y % 3) % 2 == 0; break;
default: throw "Assertion error"; default: throw "Assertion error";
} }
if (invert && !this.isFunction[y][x]) if (!this.isFunction[y][x] && invert)
this.modules[y][x] = !this.modules[y][x]; this.modules[y][x] = !this.modules[y][x];
} }
} }

Loading…
Cancel
Save