readIntLE function

BigInt readIntLE(
  1. BufferPipe pipe,
  2. int byteLength
)

Implementation

BigInt readIntLE(BufferPipe pipe, int byteLength) {
  BigInt val = readUIntLE(pipe, byteLength);
  final mul = BigInt.from(2).pow(
    (BigInt.from(8) * BigInt.from(byteLength - 1) + BigInt.from(7)).toInt(),
  );
  if (val >= mul) {
    val -= mul * BigInt.from(2);
  }
  return val;
}