feature: add option to decode to *big.Int
instead of big.Int
when decoding CBOR bignum into any
#444
Milestone
*big.Int
instead of big.Int
when decoding CBOR bignum into any
#444
What version of fxamacker/cbor are you using?
v2.5.0
Does this issue reproduce with the latest release?
yes
What OS and CPU architecture are you using (
go env
)?go env
OutputWhat did you do?
Decode CBOR big integer into
any
:https://go.dev/play/p/qDEgHDEJXum
What did you expect to see?
The stored type would be
*big.Int
What did you see instead?
The stored type is
big.Int
Context: *big.Int is designed to be pointerized: all
*big.Int
methods take and return pointers, and in general, code using Go big integers will have no reason to dereference (or deal with dereferenced) values.Dealing with dereferenced big integers at depth can be a pain (such as when the big integers are arbitrarily nested within maps/slices), especially when interoperating with other code which expects
*big.Int
; this can require post-process recursive "fixups" of the data this library produces.Furthermore, since a
big.Int
is not pointer-sized or smaller, storing it in an interface requires an additional heap allocation compared to storing the standard*big.Int
in an interface (which requires no additional allocations).The text was updated successfully, but these errors were encountered: