Faster chunkedStream_getByte()

This commit is contained in:
fkaelberer 2014-06-25 20:11:49 +02:00
parent 2e98f9095e
commit 9a41659ae7

View File

@ -155,8 +155,15 @@ var ChunkedStream = (function ChunkedStreamClosure() {
if (pos >= this.end) {
return -1;
}
this.ensureByte(pos);
return this.bytes[this.pos++];
var byte = this.bytes[pos];
if (byte === 0) {
// |byte| might be zero, because the corresponding chunk has not been
// loaded yet. In this case, this.ensureByte(pos) will throw an
// exception and nothing is returned.
this.ensureByte(pos);
}
this.pos++;
return byte;
},
getUint16: function ChunkedStream_getUint16() {