cbor icon indicating copy to clipboard operation
cbor copied to clipboard

Bignum support

Open shamblett opened this issue 6 years ago • 8 comments

Review the support for bignums in the package, at the moment these are supported only through tags

shamblett avatar Aug 15 '18 12:08 shamblett

How to work with timestamps? If Map contains this: 6: 1579254859548 //milliseconds Bignums not supported message occurs in log.

nailgilaziev avatar Jan 17 '20 16:01 nailgilaziev

This looks like a bug, timestamps aren't bignums, that said things have moved on since this package was released, Dart does now support bignums, this area needs to be addressed.

shamblett avatar Jan 18 '20 10:01 shamblett

OK, bignum encoding support now added, there is a writeBignum encoder method that takes a BigInt and the writeInt method now automativcally encodes to a bignum if the integer value is large enough. Yo can now use the new builder classes to encode lists and maps with complex types, refer to issue 10.

Package re published at version 3.1.0

shamblett avatar Apr 22 '20 14:04 shamblett

Hello, Gratitude for this library. It might just be on my computer but when trying to write an Int which is greater that 2^32 but less than 2^64 (Uint64) I see the class is using the final int two64-variable in the cbor_constants.dart-file, set to: pow(2,64). When i try to print(pow(2,64)) in a test file. i get the value: 0. This means that this library is coding ints that are greater than 2^32 and less than 2^64 as a BigNum in the stead of coding them as a Uint64.

levifeldman avatar May 16 '21 09:05 levifeldman

OK I'll have a look at this.

shamblett avatar May 16 '21 10:05 shamblett

I think I've got a solution for this, I've updated the unit tests and all is passing OK. I'll just do some final checks and hopefully re publish the package shortly.

shamblett avatar May 23 '21 11:05 shamblett

Awesome.

levifeldman avatar May 25 '21 23:05 levifeldman

OK< I still have some concerns about negative bignum handling but I think your uint64 problem has been fixed. I've re published the package at version 4.0.2, please upgrade and re test.

shamblett avatar May 29 '21 10:05 shamblett