File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,14 @@ class CborIntValue implements CborNumeric {
19
19
@override
20
20
List <int > encode () {
21
21
final bytes = CborBytesTracker ();
22
- bytes.pushInt (value.isNegative ? MajorTags .negInt : MajorTags .posInt,
23
- value.isNegative ? ~ value : value);
22
+ if (value.bitLength > 31 && value.isNegative) {
23
+ final value = (~ BigInt .parse (this .value.toString ())).toInt ();
24
+ bytes.pushInt (MajorTags .negInt, value);
25
+ } else {
26
+ // print("is here lower!");
27
+ bytes.pushInt (value.isNegative ? MajorTags .negInt : MajorTags .posInt,
28
+ value.isNegative ? ~ value : value);
29
+ }
24
30
return bytes.toBytes ();
25
31
}
26
32
Original file line number Diff line number Diff line change @@ -106,7 +106,6 @@ void _decodeDateTime() {
106
106
}
107
107
108
108
void main () {
109
- // decode
110
109
test ("cbor decode" , () {
111
110
_decodeInt ();
112
111
_decodeFloat ();
You can’t perform that action at this time.
0 commit comments