From 7bba07e24ee5bcee711cc2a0c485420190663287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Wed, 28 Sep 2022 13:18:31 +0200 Subject: [PATCH] rename fourByteCells to uint32Cells --- src/common/buffer/BufferLine.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/buffer/BufferLine.ts b/src/common/buffer/BufferLine.ts index 4483fa7a..2805f3c8 100644 --- a/src/common/buffer/BufferLine.ts +++ b/src/common/buffer/BufferLine.ts @@ -349,14 +349,14 @@ export class BufferLine implements IBufferLine { if (cols === this.length) { return this._data.length * 4 < this._data.buffer.byteLength * CLEANUP_THRESHOLD; } - const fourByteCells = cols * CELL_SIZE; + const uint32Cells = cols * CELL_SIZE; if (cols > this.length) { - if (this._data.buffer.byteLength >= fourByteCells * 4) { + if (this._data.buffer.byteLength >= uint32Cells * 4) { // optimization: avoid alloc and data copy if buffer has enough room - this._data = new Uint32Array(this._data.buffer, 0, fourByteCells); + this._data = new Uint32Array(this._data.buffer, 0, uint32Cells); } else { // slow path: new alloc and full data copy - const data = new Uint32Array(fourByteCells); + const data = new Uint32Array(uint32Cells); data.set(this._data); this._data = data; } @@ -365,7 +365,7 @@ export class BufferLine implements IBufferLine { } } else { // optimization: just shrink the view on existing buffer - this._data = this._data.subarray(0, fourByteCells); + this._data = this._data.subarray(0, uint32Cells); // Remove any cut off combined data const keys = Object.keys(this._combined); for (let i = 0; i < keys.length; i++) { @@ -384,7 +384,7 @@ export class BufferLine implements IBufferLine { } } this.length = cols; - return fourByteCells * 4 < this._data.buffer.byteLength * CLEANUP_THRESHOLD; + return uint32Cells * 4 < this._data.buffer.byteLength * CLEANUP_THRESHOLD; } /**