Read a simple var int up to 64 bits
511016
public long readVarLong() throws IOException {
    boolean more;
    long result = 0;
    do {
      int b = in.readUnsignedByte();
      more = (b & 0x80) == 0x80;
      result = 128 * result + (b & 0x7F);

      // TODO Check for long overflow
    } while (more);

    return result;
  }
396415
public long readRawVarint64() throws IOException {
    int shift = 0;
    long result = 0;
    while (shift < 64) {
      final byte b = readRawByte();
      result |= (long)(b & 0x7F) << shift;
      if ((b & 0x80) == 0) {
        return result;
      }
      shift += 7;
    }
    throw InvalidProtocolBufferException.malformedVarint();
  }
240159
public int readUnsignedInt() {
        int variableByteDecode = 0;
        byte variableByteShift = 0;

        // check if the continuation bit is set
        while ((this.bufferData[this.bufferPosition] & 0x80) != 0) {
            variableByteDecode |= (this.bufferData[this.bufferPosition++] & 0x7f) << variableByteShift;
            variableByteShift += 7;
        }

        // read the seven data bits from the last byte
        return variableByteDecode | (this.bufferData[this.bufferPosition++] << variableByteShift);
    }
1329486
public long readRawVarint64() throws IOException
    {
        final byte[] buffer = this.buffer;
        int offset = this.offset;

        int shift = 0;
        long result = 0;
        while (shift < 64)
        {
            final byte b = buffer[offset++];
            result |= (long) (b & 0x7F) << shift;
            if ((b & 0x80) == 0)
            {
                this.offset = offset;
                return result;
            }
            shift += 7;
        }
        throw ProtobufException.malformedVarint();
    }
165110
public long readRawVarint64() throws IOException
    {
        int shift = 0;
        long result = 0;
        while (shift < 64)
        {
            final byte b = readRawByte();
            result |= (long) (b & 0x7F) << shift;
            if ((b & 0x80) == 0)
            {
                return result;
            }
            shift += 7;
        }
        throw ProtobufException.malformedVarint();
    }
440798
function tinf_read_bits(d, num, base) {
  if (!num)
    return base;

  while (d.bitcount < 24) {
    d.tag |= d.source[d.sourceIndex++] << d.bitcount;
    d.bitcount += 8;
  }

  var val = d.tag & (0xffff >>> (16 - num));
  d.tag >>>= num;
  d.bitcount -= num;
  return val + base;
}
868860
void readObject(int unsigned) throws IOException {
        handleObjectStart();
        byte b = (byte) unsigned;
        if (b >= MIN_FIX_INT) {  // no need to check for b <= MAX_FIX_INT
            handleInt(b);
            
        } else if (b >= MIN_FIX_STR && b <= MAX_FIX_STR) {
            string(b - MIN_FIX_STR);
            
        } else if (b >= MIN_FIX_ARRAY && b <= MAX_FIX_ARRAY) {
            array(b - MIN_FIX_ARRAY);
            
        } else if (b >= MIN_FIX_MAP && b <= MAX_FIX_MAP) {
            map(b - MIN_FIX_MAP);
            
        } else {
            switch ((int) b) {
                case NIL:
                    handleNil();
                    break;
                case FALSE:
                    handleBoolean(false);
                    break;
                case TRUE:
                    handleBoolean(true);
                    break;
                case BIN_8: {
                    binary(input.readUnsignedByte());
                    break;
                }
                case BIN_16: {
                    binary(input.readUnsignedShort());
                    break;
                }
                case BIN_32: {
                    binary(input.readInt());
                    break;
                }
                case EXT_8: {
                    extension(input.readUnsignedByte(), false);
                    break;
                }
                case EXT_16: {
                    extension(input.readUnsignedShort(), false);
                    break;
                }
                case EXT_32: {
                    extension(input.readInt(), false);
                    break;
                }
                case FLOAT_32: {
                    float value = input.readFloat();
                    handleFloat(value);
                    break;
                }
                case FLOAT_64: {
                    double value = input.readDouble();
                    handleDouble(value);
                    break;
                }
                case UINT_8: {
                    int value = input.readUnsignedByte();
                    handleInt(value);
                    break;
                }
                case UINT_16: {
                    int value = input.readUnsignedShort();
                    handleInt(value);
                    break;
                }
                case UINT_32: {
                    int val = input.readInt();
                    if (val >= 0) {
                        handleInt(val);
                    } else {
                        long value = ((long) val) & 0xFFFFFFFFL;
                        handleUnsignedLong(value);
                    }
                    break;
                }
                case UINT_64: {
                    long value = input.readLong();
                    handleUnsignedLong(value);
                    break;
                }
                case SINT_8: {
                    int value = input.readByte();
                    handleInt(value);
                    break;
                }
                case SINT_16: {
                    int value = input.readShort();
                    handleInt(value);
                    break;
                }
                case SINT_32: {
                    int value = input.readInt();
                    handleInt(value);
                    break;
                }
                case SINT_64: {
                    long value = input.readLong();
                    handleSignedLong(value);
                    break;
                }
                case FIX_EXT_1: {
                    extension(1, true);
                    break;
                }
                case FIX_EXT_2: {
                    extension(2, true);
                    break;
                }
                case FIX_EXT_4: {
                    extension(4, true);
                    break;
                }
                case FIX_EXT_8: {
                    extension(8, true);
                    break;
                }
                case FIX_EXT_16: {
                    extension(16, true);
                    break;
                }
                case STR_8: {
                    string(input.readUnsignedByte());
                    break;
                }
                case STR_16: {
                    string(input.readUnsignedShort());
                    break;
                }
                case STR_32: {
                    string(input.readInt());
                    break;
                }
                case ARRAY_16: {
                    array(input.readUnsignedShort());
                    break;
                }
                case ARRAY_32: {
                    array(input.readInt());
                    break;
                }
                case MAP_16: {
                    map(input.readUnsignedShort());
                    break;
                }
                case MAP_32: {
                    map(input.readInt());
                    break;
                }
                default:
                    handleUnknown(b);
            }
        }
    }
1132413
private static int readCode(boolean[] rawbits, int startIndex, int length) {
    int res = 0;
    for (int i = startIndex; i < startIndex + length; i++) {
      res <<= 1;
      if (rawbits[i]) {
        res |= 0x01;
      }
    }
    return res;
  }
1190107
private static int readLen16(ByteBuffer buffer) {
        int len = 0;
        int i = Buffers.readUShort(buffer);
        if ((i & 0x8000) != 0) {
            len |= (i & 0x7fff) << 16;
            len += Buffers.readUShort(buffer);
        } else {
            len = i;
        }
        return len;
    }
1299062
function read() {
  const size = memory.readUInt32BE(offset);
  offset += 4;

  const codepoints = memory.slice(offset, offset + size);
  offset += size;

  return bitfield({ buffer: codepoints });
}
1044280
def read_var_uint32(self):
        
        i = self.read_var_uint64()
        if i > wire_format.UINT32_MAX:
            raise errors.DecodeError('Value out of range for uint32: %d' % i)
        return i
751275
public int readRawVarint32() throws IOException
    {
        byte tmp = buffer[offset++];
        if (tmp >= 0)
        {
            return tmp;
        }
        int result = tmp & 0x7f;
        if ((tmp = buffer[offset++]) >= 0)
        {
            result |= tmp << 7;
        }
        else
        {
            result |= (tmp & 0x7f) << 7;
            if ((tmp = buffer[offset++]) >= 0)
            {
                result |= tmp << 14;
            }
            else
            {
                result |= (tmp & 0x7f) << 14;
                if ((tmp = buffer[offset++]) >= 0)
                {
                    result |= tmp << 21;
                }
                else
                {
                    result |= (tmp & 0x7f) << 21;
                    result |= (tmp = buffer[offset++]) << 28;
                    if (tmp < 0)
                    {
                        // Discard upper 32 bits.
                        for (int i = 0; i < 5; i++)
                        {
                            if (buffer[offset++] >= 0)
                            {
                                return result;
                            }
                        }
                        throw ProtobufException.malformedVarint();
                    }
                }
            }
        }
        return result;
    }
617575
def _parse_var_int_components(buf, signed):
    """"""
    value = 0
    sign = 1
    while True:
        ch = buf.read(1)
        if ch == '':
            raise IonException('Variable integer under-run')
        octet = ord(ch)
        if signed:
            if octet & _VAR_INT_SIGN_MASK:
                sign = -1
            value = octet & _VAR_INT_SIGN_VALUE_MASK
            signed = False
        else:
            value <<= _VAR_INT_VALUE_BITS
            value |= octet & _VAR_INT_VALUE_MASK

        if octet & _VAR_INT_SIGNAL_MASK:
            break
    return sign, value
755907
def read_int(self):
		
		if self.reader.sysinfo.ProcessorArchitecture == PROCESSOR_ARCHITECTURE.AMD64:
			return int.from_bytes(self.read(8), byteorder = 'little', signed = True)
		else:
			return int.from_bytes(self.read(4), byteorder = 'little', signed = True)
284545
function readFixed64(/* this: Reader */) {

    /* istanbul ignore if */
    if (this.pos + 8 > this.len)
        throw indexOutOfRange(this, 8);

    return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));
}
760237
function encodeVarInt(value) {
    var bytes = [], cursor, length, i;

    do {
        bytes.push(value & 0x7F);
        value >>= 7;
    } while (value > 0);

    length = bytes.length;
    cursor = new BufferCursor(new buffer.Buffer(length));

    for (i = length - 1; i >= 0; i -= 1) {
        if (i > 0) {
            bytes[i] |= 0x80;
        }

        cursor.writeUInt8(bytes[i]);
    }

    return cursor.buffer;
}
191983
function writeVarInt (buffer, number, offset) {
  varuint.encode(number, buffer, offset);
  return varuint.encode.bytes;
}