Skip to content

Commit

Permalink
Fixed negate and toSigned operation in JS (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexDochioiu authored Jul 19, 2024
1 parent 1b7987b commit 68c53a9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/src/utils/arg.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class _ArgInt implements Arg {
final int value;

@override
_ArgInt operator ~() => _ArgInt((~value).toSigned(33));
_ArgInt operator ~() => _ArgInt((~BigInt.from(value)).toSigned(33).toInt());

@override
final bool isIndefiniteLength = false;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/value/int.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class _CborSmallIntImpl with CborValueMixin implements CborSmallInt {
if (!value.isNegative) {
sink.addHeaderInfo(0, Arg.int(value));
} else {
sink.addHeaderInfo(1, Arg.int(~value));
sink.addHeaderInfo(1, Arg.int((~BigInt.from(value)).toInt()));
}
}
}
Expand Down

0 comments on commit 68c53a9

Please sign in to comment.