Simplified a bit of JavaScript code.

This commit is contained in:
Project Nayuki 2017-08-18 01:00:16 +00:00
parent 16f504be67
commit b8587edf5f
1 changed files with 1 additions and 2 deletions

View File

@ -1004,8 +1004,7 @@ var qrcodegen = new function() {
// Returns a copy of all bytes, padding up to the nearest byte.
this.getBytes = function() {
var result = [];
var numBytes = Math.ceil(bitData.length / 8);
for (var i = 0; i < numBytes; i++)
while (result.length * 8 < bitData.length)
result.push(0);
bitData.forEach(function(bit, i) {
result[i >>> 3] |= bit << (7 - (i & 7));