Skip to content

Commit

Permalink
refactor(experimental): codecs: use bigint for range values on `u64…
Browse files Browse the repository at this point in the history
…` and `u128`
  • Loading branch information
buffalojoec authored and steveluscher committed Feb 29, 2024
1 parent 58ab189 commit 0ae2707
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/codecs-numbers/src/u128.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const getU128Encoder = (config: NumberCodecConfig = {}): FixedSizeEncoder
numberEncoderFactory({
config,
name: 'u128',
range: [0, BigInt('0xffffffffffffffffffffffffffffffff')],
range: [0n, BigInt('0xffffffffffffffffffffffffffffffff')],
set: (view, value, le) => {
const leftOffset = le ? 8 : 0;
const rightOffset = le ? 0 : 8;
Expand Down
2 changes: 1 addition & 1 deletion packages/codecs-numbers/src/u64.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const getU64Encoder = (config: NumberCodecConfig = {}): FixedSizeEncoder<
numberEncoderFactory({
config,
name: 'u64',
range: [0, BigInt('0xffffffffffffffff')],
range: [0n, BigInt('0xffffffffffffffff')],
set: (view, value, le) => view.setBigUint64(0, BigInt(value), le),
size: 8,
});
Expand Down

0 comments on commit 0ae2707

Please sign in to comment.