signedDecimalToBinary function
Convert a signed decimal number in s
to a bignum
@param size bignum size (bytes)
Implementation
Uint8List signedDecimalToBinary(int size, String s) {
var negative = s[0] == '-';
if (negative) {
s = s.substring(1);
}
var result = decimalToBinary(size, s);
if (negative) {
negate(result);
if (!isNegative(result)) {
throw 'number is out of range';
}
} else if (isNegative(result)) {
throw 'number is out of range';
}
return result;
}