static long clampedToLong(final Bytes uint) {
    if (uint.size() <= 8) {
      final long result = uint.toLong();
      return result < 0 ? Long.MAX_VALUE : result;
    }

    final Bytes trimmed = uint.trimLeadingZeros();
    if (trimmed.size() <= 8) {
      final long result = trimmed.toLong();
      return result < 0 ? Long.MAX_VALUE : result;
    } else {
      // clamp to the largest int.
      return Long.MAX_VALUE;
    }
  }
The value of the bytes as though it was representing an unsigned long, however if the value
exceeds Long.MAX_VALUE then Long.MAX_VALUE will be returned.

@param uint the unsigned integer
@return the least of the integer value or Long.MAX_VALUE
evm/src/main/java/org/hyperledger/besu/evm/internal/Words.java