Skip to content

Commit

Permalink
Handle non-int
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderOMara committed Nov 17, 2024
1 parent c05f756 commit 7769e99
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions i24.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function getUint24(
byteOffset: number,
littleEndian = false,
): number {
const c = dataView.getUint8(byteOffset + 2);
const c = dataView.getUint8((byteOffset |= 0) + 2);
const b = dataView.getUint8(byteOffset + 1);
const a = dataView.getUint8(byteOffset);
return littleEndian ? a | b << 8 | c << 16 : a << 16 | b << 8 | c;
Expand Down Expand Up @@ -74,7 +74,7 @@ export function setUint24(
b = value >> 8 & 255;
a = value >> 16 & 255;
}
if (byteOffset <= -1) {
if ((byteOffset |= 0) < 0) {
// Trigger native OOB exception.
dataView.setUint8(byteOffset, a);
}
Expand Down

0 comments on commit 7769e99

Please sign in to comment.