serializeMpInt function
Implementation
void serializeMpInt(SerializableOutput output, BigInt x) {
if (x.sign < 0) throw FormatException('Negative BigInt not supported');
Uint8List xBytes = encodeBigInt(x);
bool padX = x.bitLength > 0 && x.bitLength % 8 == 0;
output.addUint32(xBytes.length + (padX ? 1 : 0));
if (padX) output.addUint8(0);
output.addBytes(xBytes);
}