Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/util/binary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export function writeI8(value: i32, buffer: Uint8Array, offset: i32): void {

/** Reads a 16-bit integer from the specified buffer. */
export function readI16(buffer: Uint8Array, offset: i32): i32 {
return buffer[offset ]
| buffer[offset + 1] << 8;
return i32(buffer[offset ])
| i32(buffer[offset + 1]) << 8;
}

/** Writes a 16-bit integer to the specified buffer. */
Expand All @@ -27,10 +27,10 @@ export function writeI16(value: i32, buffer: Uint8Array, offset: i32): void {

/** Reads a 32-bit integer from the specified buffer. */
export function readI32(buffer: Uint8Array, offset: i32): i32 {
return buffer[offset ]
| buffer[offset + 1] << 8
| buffer[offset + 2] << 16
| buffer[offset + 3] << 24;
return i32(buffer[offset ])
| i32(buffer[offset + 1]) << 8
| i32(buffer[offset + 2]) << 16
| i32(buffer[offset + 3]) << 24;
}

/** Writes a 32-bit integer to the specified buffer. */
Expand Down