no2chem / bigint-buffer

💪🔢 bigint-buffer: Buffer Utilities for TC39 BigInt Proposal
Apache License 2.0
54 stars 11 forks source link

signed/negative bigint are not handled #58

Closed vekexasia closed 6 months ago

vekexasia commented 6 months ago

Apparently the library can't handle negative values (both encoding and decoding)

console.log(toBufferLE(-1n, 1)); console.log(toBufferLE(1n, 1));

outputs <Buffer 01> <Buffer 01>

but it should really not be the case.

vekexasia commented 6 months ago

for those of you landing in this issue cause you need a bigint <-> buffer implementation that is sign-sensitive, i've created a library just for that: