def cast_to_int(s, max_num_size = DEFAULT_MAX_NUM_SIZE)
      data = s.htb
      raise '"script number overflow"' if data.bytesize > max_num_size
      if require_minimal && data.bytesize > 0
        if data.bytes[-1] & 0x7f == 0 && (data.bytesize <= 1 || data.bytes[data.bytesize - 2] & 0x80 == 0)
          raise 'non-minimally encoded script number'
        end
      end
      Script.decode_number(s)
    end
def cast_to_int(s, max_num_size = DEFAULT_MAX_NUM_SIZE)
      data = s.htb
      raise '"script number overflow"' if data.bytesize > max_num_size
      if require_minimal && data.bytesize > 0
        if data.bytes[-1] & 0x7f == 0 && (data.bytesize <= 1 || data.bytes[data.bytesize - 2] & 0x80 == 0)
          raise 'non-minimally encoded script number'
        end
      end
      Script.decode_number(s)
    end
cast item to int value.