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
feature: add built-in support for big.Int #209
Milestone
Comments
fxamacker
added a commit
that referenced
this issue
May 20, 2020
By default, encode big.Int value to CBOR integer (if value fits), otherwise encode to CBOR bignum (CBOR tag 2 or 3). BigIntConvert is the CBOR encoding option for big.Int: - BigIntConvertShortest: (default) encode big.Int to CBOR integer if value fits, otherwise encode to CBOR bignum. - BigIntConvertNone: encode big.Int to CBOR bignum without converting it to another CBOR type. Decoder can decode the following to big.Int: - CBOR bignum (tags 2 and 3) - CBOR integers (major type 0 and 1) When decoding CBOR bignum to empty interface, decode to big.Int. When decoding CBOR negative integer (major type 1) to empty interface: - if value fits int64, decode to int64. - if value doesn't fit int64, decode to big.Int. Closes #209
fxamacker
added a commit
that referenced
this issue
May 20, 2020
By default, encode big.Int value to CBOR integer (if value fits), otherwise encode to CBOR bignum (CBOR tag 2 or 3). BigIntConvert is the CBOR encoding option for big.Int: - BigIntConvertShortest: (default) encode big.Int to CBOR integer if value fits, otherwise encode to CBOR bignum. - BigIntConvertNone: encode big.Int to CBOR bignum without converting it to another CBOR type. Decoder can decode the following to big.Int: - CBOR bignum (tags 2 and 3) - CBOR integers (major type 0 and 1) When decoding CBOR bignum to empty interface, decode to big.Int. When decoding CBOR negative integer (major type 1) to empty interface: - if value fits int64, decode to int64. - if value doesn't fit int64, decode to big.Int. Closes #209
x448
changed the title
feature: add built-in support for big.Int so users don't have to implement it
feature: add built-in support for big.Int
May 21, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
The "Limitations" section of README.md states:
Describe the solution you'd like
Add support for encoding and decoding big.Int to handle numbers that can't fit into Go's int64.
Also add fuzzing for big.Int in fxamacker/cbor-fuzz.
Describe alternatives you've considered
Tell users to implement it via the API already provided by fxamacker/cbor.
One project using fxamacker/cbor 1.5 with big integers doesn't use Go's big.Int because they have their own big integers implementation they prefer over big.Int.
The text was updated successfully, but these errors were encountered: