Merge pull request #4894 from CodingFabian/optimize-jpgjs-receiveAndExtend

Optimize JPG.js receiveAndExtend for 1 bit case.
This commit is contained in:
Yury Delendik 2014-06-05 10:15:28 -05:00
commit 9308b525e5

View File

@ -159,6 +159,9 @@ var JpegImage = (function jpegImage() {
}
function receiveAndExtend(length) {
if (length === 1) {
return readBit() === 1 ? 1 : -1;
}
var n = receive(length);
if (n >= 1 << (length - 1)) {
return n;