Load variable-size int.
358035
def load_vint(buf, pos):
    """"""
    limit = min(pos + 11, len(buf))
    res = ofs = 0
    while pos < limit:
        b = _byte_code(buf[pos])
        res += ((b & 0x7F) << ofs)
        pos += 1
        ofs += 7
        if b < 0x80:
            return res, pos
    raise BadRarFile('cannot load vint')
1256475
private int getVariableSize(int variable) {
    for (int i = 0; i < neighborIndices.length; i++) {
      if (neighborIndices[i] == variable) return getDimensions()[i];
    }
    return 0;
  }
400293
def _VarintSize(value):
  """"""
  if value <= 0x7f: return 1
  if value <= 0x3fff: return 2
  if value <= 0x1fffff: return 3
  if value <= 0xfffffff: return 4
  if value <= 0x7ffffffff: return 5
  if value <= 0x3ffffffffff: return 6
  if value <= 0x1ffffffffffff: return 7
  if value <= 0xffffffffffffff: return 8
  if value <= 0x7fffffffffffffff: return 9
  return 10
946216
private int readVarInts() {
        int i = 0;
        int count = 0;
        short s;
        do {
            if (count > 4) {
                throw new ParserException("read varints error.");
            }
            s = Buffers.readUByte(buffer);
            i |= (s & 0x7f) << (count * 7);
            count++;
        } while ((s & 0x80) != 0);

        return i;
    }
361680
public void load() throws IOException {
		numericData = muffin.loadFile(fileName + "_Number");
		stringData = muffin.loadFile(fileName + "_String");
	}
456136
def read(self, addr, size):
        '''

        '''
        self.set_addr(addr | 0x01)
        self.set_size(size)
        self.start()
        while not self.is_ready:
            pass

        return self.get_data(size)
633487
public static InsnList loadIntConst(int i) {
        InsnList ret = new InsnList();
        ret.add(new LdcInsnNode(i));
        return ret;
    }
1170048
def load(self, name, code):
        """"""

        source = "\n".join(code)
        self._objects[name] = source
707540
def from_int(value):
        """"""
        if not isinstance(value, int):
            raise PyVLXException("value_has_to_be_int")
        if not Parameter.is_valid_int(value):
            raise PyVLXException("value_out_of_range")
        return bytes([value >> 8 & 255, value & 255])
552831
def _calc_T_var(self,X) -> int:
        """"""
        shape = X.shape
        tensor_rank: int = len(shape)
        if tensor_rank == 0:
            return 1
        if tensor_rank == 1:
            return shape[0]
        if tensor_rank == 2:
            if shape[1] > 1:
                raise ValueError('Initial value of a variable must have dimension T*1.')
            return shape[0]
1296040
def _load_int(self):
        """"""
        values = numpy.fromfile(self.filepath_int)
        if self.NDIM > 0:
            values = values.reshape(self.seriesshape)
        return values
846469
private int loadSlack(int dim, int bin) {
        return p.loads[dim][bin].getUB() - p.loads[dim][bin].getLB();
    }
1278721
public static int varintSizeInBytes(long v) {
    if ((v & (0xffffffffffffffffL << 7)) == 0) return 1;
    if ((v & (0xffffffffffffffffL << 14)) == 0) return 2;
    if ((v & (0xffffffffffffffffL << 21)) == 0) return 3;
    if ((v & (0xffffffffffffffffL << 28)) == 0) return 4;
    if ((v & (0xffffffffffffffffL << 35)) == 0) return 5;
    if ((v & (0xffffffffffffffffL << 42)) == 0) return 6;
    if ((v & (0xffffffffffffffffL << 49)) == 0) return 7;
    if ((v & (0xffffffffffffffffL << 56)) == 0) return 8;
    if ((v & (0xffffffffffffffffL << 63)) == 0) return 9;
    return 10;
  }
666763
def asnumpy(self):
        """"""

        # Create C variables that will serve as out parameters for TCMPS.
        data_ptr = _ctypes.POINTER(_ctypes.c_float)()    # float* data_ptr
        shape_ptr = _ctypes.POINTER(_ctypes.c_size_t)()  # size_t* shape_ptr
        dim = _ctypes.c_size_t()                         # size_t dim

        # Obtain pointers into memory owned by the C++ object self.handle.
        # Note that this may trigger synchronization with another thread
        # producing the data.
        status_code = self._LIB.TCMPSReadFloatArray(
            self.handle, _ctypes.byref(data_ptr), _ctypes.byref(shape_ptr),
            _ctypes.byref(dim))
        assert status_code == 0, "Error calling TCMPSReadFloatArray"

        return _numpy_array_from_ctypes(data_ptr, shape_ptr, dim)
233451
def load_data(self, idx):
        """"""
        for name in self:
            ndim = getattr(self, '_%s_ndim' % name)
            diskflag = getattr(self, '_%s_diskflag' % name)
            ramflag = getattr(self, '_%s_ramflag' % name)
            if diskflag:
                file_ = getattr(self, '_%s_file' % name)
                length_tot = 1
                shape = []
                for jdx in range(ndim):
                    length = getattr(self, '_%s_length_%s' % (name, jdx))
                    length_tot *= length
                    shape.append(length)
                raw = file_.read(length_tot*8)
                values = struct.unpack(length_tot*'d', raw)
                if ndim:
                    values = numpy.array(values).reshape(shape)
                else:
                    values = values[0]
            elif ramflag:
                array = getattr(self, '_%s_array' % name)
                values = array[idx]
            if diskflag or ramflag:
                if ndim == 0:
                    setattr(self, name, values)
                else:
                    getattr(self, name)[:] = values
246013
def read_int(self, signed=True):
        """"""
        return int.from_bytes(self.read(4), byteorder='little', signed=signed)
92393
public static function size_varint($i) {
/*		$len = 0;
		do {
			$i = $i >> 7;
			$len++;
		} while ($i != 0);
		return $len;
*/
		// TODO Change to a binary search
		if ($i < 0x80)
			return 1;
		if ($i < 0x4000)
			return 2;
		if ($i < 0x200000)
			return 3;
		if ($i < 0x10000000)
			return 4;
		if ($i < 0x800000000)
			return 5;
		if ($i < 0x40000000000)
			return 6;
		if ($i < 0x2000000000000)
			return 7;
		if ($i < 0x100000000000000)
			return 8;
		if ($i < 0x8000000000000000)
			return 9;
	}