Merge pull request #4894 from CodingFabian/optimize-jpgjs-receiveAndExtend
Optimize JPG.js receiveAndExtend for 1 bit case.
This commit is contained in:
commit
9308b525e5
@ -159,6 +159,9 @@ var JpegImage = (function jpegImage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function receiveAndExtend(length) {
|
function receiveAndExtend(length) {
|
||||||
|
if (length === 1) {
|
||||||
|
return readBit() === 1 ? 1 : -1;
|
||||||
|
}
|
||||||
var n = receive(length);
|
var n = receive(length);
|
||||||
if (n >= 1 << (length - 1)) {
|
if (n >= 1 << (length - 1)) {
|
||||||
return n;
|
return n;
|
||||||
|
Loading…
Reference in New Issue
Block a user