dtn7 / cboring

Go library for selected subset of CBOR's features
GNU General Public License v3.0
2 stars 2 forks source link

Missing method wrappers for number types #3

Closed mikhgaus closed 1 year ago

mikhgaus commented 1 year ago

Cboring doesn't have method wrappers for other unsigned integer sizes. It only accepts uint64.

Also i couldn't find methods for writing signed integers.

oxzi commented 1 year ago

Cboring doesn't have method wrappers for other unsigned integer sizes. It only accepts uint64.

As there is only one unsigned integer major type for numbers up to 2^64-1^rfc8949-major-types, cboring's API reflects this decision by using Golang's only fitting type, uint64.

Of course, one could add a wrapper for, for example, uint32, which checks if the number is within the type's limit, but imho this is out of this library's scope. Furthermore, as written in the README, this libary's scope is to provide the necessary features for dtn7-go.

Also i couldn't find methods for writing signed integers.

Again, as written in the README, unsigned ints were out of scope.

Feel free to add create a PR for this, but you might wanna check out fxamacker/cbor^fxamacker-cbor, a more complete and highly performing CBOR implementation. As I don't have the time to maintain dtn7-go anymore, work on cboring has also halted.