From 4ab706372afbd5903019fc10a11d2e1f396204e9 Mon Sep 17 00:00:00 2001 From: Razvan Nazare Date: Tue, 26 Mar 2024 11:45:47 +0200 Subject: [PATCH] changed Uint32Arrays into Int32Array we expect to receive negative values for colIndexes and rowIndexes, therefore we need a data structure that allows negative values --- .../build/generate-workers/source/matrix-renderer.ts | 12 ++++++------ .../source/tests/matrix-renderer.spec.ts | 4 ++-- .../build/generate-workers/source/types.ts | 4 ++-- .../wafer-map/tests/create-matrix-renderer.spec.ts | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/nimble-components/build/generate-workers/source/matrix-renderer.ts b/packages/nimble-components/build/generate-workers/source/matrix-renderer.ts index a7c680a9f6..e0ec73ee6c 100644 --- a/packages/nimble-components/build/generate-workers/source/matrix-renderer.ts +++ b/packages/nimble-components/build/generate-workers/source/matrix-renderer.ts @@ -9,8 +9,8 @@ import type { Dimensions, Transform, WaferMapMatrix, WaferMapTypedMatrix } from * This setup is used in the wafer-map component to perform heavy computational duties */ export class MatrixRenderer { - public colIndexes: Uint32Array = Uint32Array.from([]); - public rowIndexes: Uint32Array = Uint32Array.from([]); + public colIndexes: Int32Array = Int32Array.from([]); + public rowIndexes: Int32Array = Int32Array.from([]); public values = new Float64Array([]); public scaledColIndex = new Float64Array([]); public scaledRowIndex = new Float64Array([]); @@ -72,8 +72,8 @@ export class MatrixRenderer { } public emptyMatrix(): void { - this.colIndexes = Uint32Array.from([]); - this.rowIndexes = Uint32Array.from([]); + this.colIndexes = Int32Array.from([]); + this.rowIndexes = Int32Array.from([]); this.values = Float64Array.from([]); } @@ -91,8 +91,8 @@ export class MatrixRenderer { public updateMatrix( data: WaferMapMatrix ): void { - this.colIndexes = Uint32Array.from(data.colIndexes); - this.rowIndexes = Uint32Array.from(data.rowIndexes); + this.colIndexes = Int32Array.from(data.colIndexes); + this.rowIndexes = Int32Array.from(data.rowIndexes); this.values = Float64Array.from(data.values); } diff --git a/packages/nimble-components/build/generate-workers/source/tests/matrix-renderer.spec.ts b/packages/nimble-components/build/generate-workers/source/tests/matrix-renderer.spec.ts index 60ebef1ff9..0063d43679 100644 --- a/packages/nimble-components/build/generate-workers/source/tests/matrix-renderer.spec.ts +++ b/packages/nimble-components/build/generate-workers/source/tests/matrix-renderer.spec.ts @@ -18,8 +18,8 @@ describe('MatrixRenderer with MessageChannel', () => { const updatedMatrix = await matrixRenderer.getMatrix(); expect(updatedMatrix).toEqual( { - colIndexes: Uint32Array.from(testData.colIndexes), - rowIndexes: Uint32Array.from(testData.rowIndexes), + colIndexes: Int32Array.from(testData.colIndexes), + rowIndexes: Int32Array.from(testData.rowIndexes), values: Float64Array.from(testData.values) } ); diff --git a/packages/nimble-components/build/generate-workers/source/types.ts b/packages/nimble-components/build/generate-workers/source/types.ts index 8c85f425b2..f6e5d4e655 100644 --- a/packages/nimble-components/build/generate-workers/source/types.ts +++ b/packages/nimble-components/build/generate-workers/source/types.ts @@ -1,6 +1,6 @@ export interface WaferMapTypedMatrix { - colIndexes: Uint32Array; - rowIndexes: Uint32Array; + colIndexes: Int32Array; + rowIndexes: Int32Array; values: Float64Array; } diff --git a/packages/nimble-components/src/wafer-map/tests/create-matrix-renderer.spec.ts b/packages/nimble-components/src/wafer-map/tests/create-matrix-renderer.spec.ts index 80d3759b74..7e4d858527 100644 --- a/packages/nimble-components/src/wafer-map/tests/create-matrix-renderer.spec.ts +++ b/packages/nimble-components/src/wafer-map/tests/create-matrix-renderer.spec.ts @@ -27,10 +27,10 @@ describe('MatrixRenderer worker', () => { const resolvedDieMatrix = await matrixRenderer.getMatrix(); expect(resolvedDieMatrix.colIndexes).toEqual( - Uint32Array.from(testData.colIndexes) + Int32Array.from(testData.colIndexes) ); expect(resolvedDieMatrix.rowIndexes).toEqual( - Uint32Array.from(testData.rowIndexes) + Int32Array.from(testData.rowIndexes) ); expect(resolvedDieMatrix.values).toEqual( Float64Array.from(testData.values)