toBigInt method

BigInt toBigInt()

converts the field element to a big integer.

Implementation

BigInt toBigInt() {
  List<int> buf = Bytes();
  BigInt result = BigInt.zero;

  for (int i = buf.length - 1; i >= 0; i--) {
    // Shift the result left by 8 bits.
    // OR the next byte into the result.
    result = (result << 8) | BigInt.from(buf[i]);
  }

  return result;
}