Merge pull request #19589 from Snuffleupagus/RunLengthStream-fill

Replace a loop with `TypedArray.prototype.fill()` in the `RunLengthStream` class
This commit is contained in:
Tim van der Meij 2025-03-02 15:36:49 +01:00 committed by GitHub
commit dfa6370161
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,11 +48,9 @@ class RunLengthStream extends DecodeStream {
} }
} else { } else {
n = 257 - n; n = 257 - n;
const b = repeatHeader[1];
buffer = this.ensureBuffer(bufferLength + n + 1); buffer = this.ensureBuffer(bufferLength + n + 1);
for (let i = 0; i < n; i++) { buffer.fill(repeatHeader[1], bufferLength, bufferLength + n);
buffer[bufferLength++] = b; bufferLength += n;
}
} }
this.bufferLength = bufferLength; this.bufferLength = bufferLength;
} }