Skip to content

Commit

Permalink
Merge pull request #5191 from nnethercote/getSampleArray-array-length
Browse files Browse the repository at this point in the history
Right-size the array in getSampleArray().
  • Loading branch information
Snuffleupagus committed Aug 15, 2014
2 parents cd5bd9f + bcc31b6 commit 9d87cbc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var PDFFunction = (function PDFFunctionClosure() {
}
length *= outputSize;

var array = [];
var array = new Array(length);
var codeSize = 0;
var codeBuf = 0;
// 32 is a valid bps so shifting won't work
Expand All @@ -50,7 +50,7 @@ var PDFFunction = (function PDFFunctionClosure() {
codeSize += 8;
}
codeSize -= bps;
array.push((codeBuf >> codeSize) * sampleMul);
array[i] = (codeBuf >> codeSize) * sampleMul;
codeBuf &= (1 << codeSize) - 1;
}
return array;
Expand Down

0 comments on commit 9d87cbc

Please sign in to comment.