Skip to content

React-native bigint64 deserialization problem - refactoring/bigint64le #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
byte lenght bugfix
  • Loading branch information
Admdebian committed Nov 29, 2021
commit 5377e05d01fc53abe0495cfc08d9e59cfd779bd9
4 changes: 2 additions & 2 deletions src/readBig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ function boundsError(value: number, length: number) {

// This function works with react-native >= 0.66.1
export function readBigInt64LE(buffer: Buffer, offset = 0): bigint {
return BigInt(buffer.readIntLE(offset, 8))
return BigInt(buffer.readIntLE(offset, 6))
}

// This function works with react-native >= 0.66.1
export function readBigUInt64LE(buffer: Buffer, offset = 0): bigint {
return BigInt(buffer.readUIntLE(offset, 8))
return BigInt(buffer.readUIntLE(offset, 6))
}