Replace a loop with TypedArray.prototype.fill() in the RunLengthStream class
This is a tiny bit shorter, which cannot hurt.
This commit is contained in:
parent
89ccc3a526
commit
a3d259a681
@ -48,11 +48,9 @@ class RunLengthStream extends DecodeStream {
|
||||
}
|
||||
} else {
|
||||
n = 257 - n;
|
||||
const b = repeatHeader[1];
|
||||
buffer = this.ensureBuffer(bufferLength + n + 1);
|
||||
for (let i = 0; i < n; i++) {
|
||||
buffer[bufferLength++] = b;
|
||||
}
|
||||
buffer.fill(repeatHeader[1], bufferLength, bufferLength + n);
|
||||
bufferLength += n;
|
||||
}
|
||||
this.bufferLength = bufferLength;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user