diff --git a/packages/typed-binary/src/io/bufferIOBase.ts b/packages/typed-binary/src/io/bufferIOBase.ts index 321185a..86b5815 100644 --- a/packages/typed-binary/src/io/bufferIOBase.ts +++ b/packages/typed-binary/src/io/bufferIOBase.ts @@ -17,7 +17,7 @@ export class BufferIOBase { protected readonly uint8View: Uint8Array; protected readonly helperInt32View: Int32Array; protected readonly helperUint32View: Uint32Array; - protected readonly helperFloat16View: Uint16Array; + protected readonly helperUint16View: Uint16Array; protected readonly helperFloat32View: Float32Array; protected readonly helperByteView: Uint8Array; protected readonly switchEndianness: boolean; @@ -46,7 +46,7 @@ export class BufferIOBase { this.helperUint32View = new Uint32Array(helperBuffer); this.helperFloat32View = new Float32Array(helperBuffer); this.helperByteView = new Uint8Array(helperBuffer); - this.helperFloat16View = new Uint16Array(helperBuffer); + this.helperUint16View = new Uint16Array(helperBuffer); } get currentByteOffset() { diff --git a/packages/typed-binary/src/io/bufferReader.ts b/packages/typed-binary/src/io/bufferReader.ts index 6d872d7..c845592 100644 --- a/packages/typed-binary/src/io/bufferReader.ts +++ b/packages/typed-binary/src/io/bufferReader.ts @@ -31,7 +31,7 @@ export class BufferReader extends BufferIOBase implements ISerialInput { readFloat16() { this.copyInputToHelper(2); - return float16ToNumber(this.helperFloat16View); + return float16ToNumber(this.helperUint16View); } readFloat32() { diff --git a/packages/typed-binary/src/io/bufferWriter.ts b/packages/typed-binary/src/io/bufferWriter.ts index 24799e9..f7cdd55 100644 --- a/packages/typed-binary/src/io/bufferWriter.ts +++ b/packages/typed-binary/src/io/bufferWriter.ts @@ -28,7 +28,7 @@ export class BufferWriter extends BufferIOBase implements ISerialOutput { } writeFloat16(value: number): void { - this.helperFloat16View[0] = numberToFloat16(value)[0]; + this.helperUint16View[0] = numberToFloat16(value)[0]; this.copyHelperToOutput(2); }