Return the smallest size int that can store the value
517589
def _int_size(x):
    """"""
    if -0x80 <= x <= 0x7F:
        return 1
    elif -0x8000 <= x <= 0x7FFF:
        return 2
    elif -0x80000000 <= x <= 0x7FFFFFFF:
        return 4
    elif long(-0x8000000000000000) <= x <= long(0x7FFFFFFFFFFFFFFF):
        return 8
    else:
        raise RuntimeError("Cannot represent value: " + str(x))
979842
def calculate_size(name, values):
    
    data_size = 0
    data_size += calculate_size_str(name)
    data_size += INT_SIZE_IN_BYTES
    for values_item in values:
        data_size += calculate_size_data(values_item)
    return data_size
496359
def get_minimum_size(self, data):
        """"""
        width = 0
        min_height = 0
        for element in self.elements:
            size = element.get_minimum_size(data)
            min_height = max(min_height, size.y)
            width += size.x
        width += (len(self.elements)-1)*self.margin
        return datatypes.Point(width, min_height)
913208
function TINYINT(length) {
    length = length || 255;
    if (!(this instanceof TINYINT)) {
        return new TINYINT(length);
    }
    this.length = length;
    this.sql = 'TINYINT(' + this.length + ')';
}
727597
def calculate_size(name, index, value):
    
    data_size = 0
    data_size += calculate_size_str(name)
    data_size += INT_SIZE_IN_BYTES
    data_size += calculate_size_data(value)
    return data_size
8977
public IntegerSize getIntegerSize()
    {
        load_once();
        if (_value_type != IonType.INT || _v.isNull())
        {
            return null;
        }
        return _Private_ScalarConversions.getIntegerSize(_v.getAuthoritativeType());
    }
361891
def get_minimum_size(self, data):
        """"""
        min_width = 0
        min_height = 0
        for element in self.elements:
            size = (
                datatypes.Point(0, 0) if element is None
                else element.get_minimum_size(data)
                )
            min_height = max(min_height, size.y)
            min_width = max(min_width, size.x)

        num_elements = len(self.elements)
        height = min_height * num_elements + self.margin * (num_elements-1)
        return datatypes.Point(min_width, height)
1153305
def get_value_len(value):
    '''
    
    '''
    try:
        Nvalue = len(value)
    except TypeError:
        # convert iterator/generator to list
        value = list(value)
        Nvalue = len(value)
    return Nvalue, value
14744
def _min(self):
        """"""
        return (
            self.range[0] if (self.range and self.range[0] is not None) else
            (min(self._values) if self._values else None)
        )
170165
def closest_length(refs, pred):
    '''
    
    '''
    smallest_diff = float('inf')
    closest_length = float('inf')
    for ref in refs:
        diff = abs(len(ref) - len(pred))
        if diff < smallest_diff or (diff == smallest_diff and len(ref) < closest_length):
            smallest_diff = diff
            closest_length = len(ref)
    return closest_length
1060829
public static int min(int[] values)
    {
        int min = Integer.MAX_VALUE;

        for (int i = 0; i < values.length; ++i)
        {
            if (values[i] < min)
            {
                min = values[i];
            }
        }

        return min;
    }
788325
def calculate_size(name, reduction):
    
    data_size = 0
    data_size += calculate_size_str(name)
    data_size += INT_SIZE_IN_BYTES
    return data_size
638393
public static int min(int[] x) {
        int m = x[0];

        for (int n : x) {
            if (n < m) {
                m = n;
            }
        }

        return m;
    }
671372
private int findMin(Comparator comparator, int index, int len)
  {
    if (index >= heapSize) {
      return -1;
    }
    int limit = Math.min(index, heapSize - len) + len;
    int minIndex = index;
    for (int i = index + 1; i < limit; i++) {
      if (comparator.compare(buf.getInt(i * Integer.BYTES), buf.getInt(minIndex * Integer.BYTES)) < 0) {
        minIndex = i;
      }
    }
    return minIndex;
  }
409220
def size(self):
        """"""
        initial_count = self.count()
        count_with_skip = max(0, initial_count - self._skip)
        size = min(count_with_skip, self._limit)
        return size
821341
@Override
    public int smallByteSize() {
        int bound = byteSize();
        ByteBuffer buf = ByteBuffer.allocate(bound);
        asSmallBytes(buf);
        return buf.position();
    }
326459
private BigInteger getLower(int n) {
        if (isZero()) {
            return BigInteger.ZERO;
        } else if (intLen < n) {
            return toBigInteger(1);
        } else {
            // strip zeros
            int len = n;
            while (len > 0 && value[offset+intLen-len] == 0)
                len--;
            int sign = len > 0 ? 1 : 0;
            return new BigInteger(Arrays.copyOfRange(value, offset+intLen-len, offset+intLen), sign);
        }
    }