Skip to content

Commit

Permalink
refactor: get and set bytes from bytes array
Browse files Browse the repository at this point in the history
  • Loading branch information
Conaclos committed Jan 16, 2022
1 parent 7c2edd1 commit 3bf7017
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/codec/primitive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ export function writeIntSafe(bc: ByteCursor, x: number): void {

export function readU8(bc: ByteCursor): number {
bc.check(1)
return bc.view.getUint8(bc.offset++)
return bc.bytes[bc.offset++]
}

export function writeU8(bc: ByteCursor, x: number): void {
assert(isU8(x), TOO_LARGE_NUMBER)
bc.reserve(1)
bc.view.setUint8(bc.offset++, x)
bc.bytes[bc.offset++] = x
}

export function readU16(bc: ByteCursor): number {
Expand Down

0 comments on commit 3bf7017

Please sign in to comment.