Reads an unsigned 32 bit value from the stream, as a long.
@return An unsigned 32 bit value.
@throws WireParseException The end of the stream was reached.
550506
public long
readU32() throws WireParseException {
	require(4);
	int b1 = array[pos++] & 0xFF;
	int b2 = array[pos++] & 0xFF;
	int b3 = array[pos++] & 0xFF;
	int b4 = array[pos++] & 0xFF;
	return (((long)b1 << 24) + (b2 << 16) + (b3 << 8) + b4);
}
1316721
static long getFiveBytesLong(byte[] buffer, int offset) {
        return (buffer[offset] & 0xffL) << 32 | (buffer[offset + 1] & 0xffL) << 24 | (buffer[offset + 2] & 0xffL) << 16
                | (buffer[offset + 3] & 0xffL) << 8 | (buffer[offset + 4] & 0xffL);
    }
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();
    }
1061224
public static int readUnsignedVarint(ByteBuffer buffer) throws IOException {
    int val = 0;
    int bits = 0;
    while(true) {
      final int data = buffer.get();
      val |= (data & 0x7F) << bits;
      if((data & 0x80) == 0) {
        return val;
      }
      bits += 7;
      if(bits > 35) {
        throw new IOException("Variable length quantity is too long for expected integer.");
      }
    }
  }
1146856
long readLong()
    throws IOException
  {
    return (((long) _is.read() << 56) |
            ((long) _is.read() << 48) |
            ((long) _is.read() << 40) |
            ((long) _is.read() << 32) |
            ((long) _is.read() << 24) |
            ((long) _is.read() << 16) |
            ((long) _is.read() << 8) |
            ((long) _is.read()));
  }
684209
public function readLong()
    {
        /**
         * Check, that we work in 64-bit mode.
         * fseek() uses long for offset. Thus, largest index segment file size in 32bit mode is 2Gb
         */
        if (PHP_INT_SIZE > 4) {
            $str = $this->_fread(8);

            return  ord($str[0]) << 56  |
                    ord($str[1]) << 48  |
                    ord($str[2]) << 40  |
                    ord($str[3]) << 32  |
                    ord($str[4]) << 24  |
                    ord($str[5]) << 16  |
                    ord($str[6]) << 8   |
                    ord($str[7]);
        } else {
            return $this->readLong32Bit();
        }
    }
646588
public long readLELong() throws IOException {
		return EndianNumbers.toLELong(read(), read(), read(), read(), read(), read(), read(), read());
	}
743839
public function read_long()
    {
        $this->bitcount = $this->bits = 0;
        list(, $res) = unpack('N', $this->rawread(4));

        return empty($this->is64bits) && self::getLongMSB($res) ? sprintf('%u', $res) : $res;
    }
799864
public static long readLong(byte[] source, int position) {
        return (long) (source[position] & 0xFF) << 56
                | (long) (source[position + 1] & 0xFF) << 48
                | (long) (source[position + 2] & 0xFF) << 40
                | (long) (source[position + 3] & 0xFF) << 32
                | (long) (source[position + 4] & 0xFF) << 24
                | (source[position + 5] & 0xFF) << 16
                | (source[position + 6] & 0xFF) << 8
                | (source[position + 7] & 0xFF);
    }
1207288
public static long readRawVarint64(final InputStream is, long eofValue) throws IOException {
        int shift = 0;
        long result = 0;
        while (shift < 64) {
            final int b = is.read();

            if (b == -1)
                if (shift == 0)
                    return eofValue;
                else
                    throw new IOException("Malformed Varint");

            result |= (long) (b & 0x7F) << shift;
            if ((b & 0x80) == 0) {
                return result;
            }
            shift += 7;
        }
        throw new IOException("Malformed Varint");
    }
257554
public BigInteger readMPINT32() throws IOException {
		int bits = (int) readInt();

		byte[] raw = new byte[(bits + 7) / 8 + 1];

		raw[0] = 0;
		readFully(raw, 1, raw.length - 1);

		return new BigInteger(raw);

	}
562785
public long readVLong() {
        /* This is the original code of this method,
         * but a Hotspot bug (see LUCENE-2975) corrupts the for-loop if
         * readByte() is inlined. So the loop was unwinded!
         byte b = readByte();
         long i = b & 0x7F;
         for (int shift = 7; (b & 0x80) != 0; shift += 7) {
         b = readByte();
         i |= (b & 0x7FL) << shift;
         }
         return i;
         */
        byte b = readByte();
        if (b >= 0) {
            return b;
        }
        long i = b & 0x7FL;
        b = readByte();
        i |= (b & 0x7FL) << 7;
        if (b >= 0) {
            return i;
        }
        b = readByte();
        i |= (b & 0x7FL) << 14;
        if (b >= 0) {
            return i;
        }
        b = readByte();
        i |= (b & 0x7FL) << 21;
        if (b >= 0) {
            return i;
        }
        b = readByte();
        i |= (b & 0x7FL) << 28;
        if (b >= 0) {
            return i;
        }
        b = readByte();
        i |= (b & 0x7FL) << 35;
        if (b >= 0) {
            return i;
        }
        b = readByte();
        i |= (b & 0x7FL) << 42;
        if (b >= 0) {
            return i;
        }
        b = readByte();
        i |= (b & 0x7FL) << 49;
        if (b >= 0) {
            return i;
        }
        b = readByte();
        i |= (b & 0x7FL) << 56;
        if (b >= 0) {
            return i;
        }
        throw new RuntimeException("Invalid vLong detected (negative values disallowed)");
    }
87309
public long readLong() {
    return ((buf[position++] & 0xff)
        + ((long) (buf[position++] & 0xff) << 8)
        + ((long) (buf[position++] & 0xff) << 16)
        + ((long) (buf[position++] & 0xff) << 24)
        + ((long) (buf[position++] & 0xff) << 32)
        + ((long) (buf[position++] & 0xff) << 40)
        + ((long) (buf[position++] & 0xff) << 48)
        + ((long) (buf[position++] & 0xff) << 56));
  }
871451
public static long readLong(byte[] buf, int pos) {
    checkBoundary(buf, pos, 8);
    return (((long) (buf[pos++] & 0xff) << 56) | ((long) (buf[pos++] & 0xff) << 48)
        | ((long) (buf[pos++] & 0xff) << 40) | ((long) (buf[pos++] & 0xff) << 32)
        | ((long) (buf[pos++] & 0xff) << 24) | ((long) (buf[pos++] & 0xff) << 16)
        | ((long) (buf[pos++] & 0xff) << 8) | ((long) (buf[pos] & 0xff)));
  }
1095911
static long toLong(final byte[] buffer, final int offset) {
        final long value1 = toInt(buffer, offset);
        final long value2 = toInt(buffer, offset + 4);
        return (value1 << 32) + ((value2 << 32) >>> 32);
    }
1232488
@Override
  public long readLong() throws IOException {
    readFully(work, 0, 8);
    return
        (((long) work[0]) & 0xffL) |
        (((long) work[1]) & 0xffL) << 8 |
        (((long) work[2]) & 0xffL) << 16 |
        (((long) work[3]) & 0xffL) << 24 |
        (((long) work[4]) & 0xffL) << 32 |
        (((long) work[5]) & 0xffL) << 40 |
        (((long) work[6]) & 0xffL) << 48 |
        (((long) work[7]) & 0xffL) << 56;
  }
354910
public int readRawVarint32() throws IOException {
    byte tmp = readRawByte();
    if (tmp >= 0) {
      return tmp;
    }
    int result = tmp & 0x7f;
    if ((tmp = readRawByte()) >= 0) {
      result |= tmp << 7;
    } else {
      result |= (tmp & 0x7f) << 7;
      if ((tmp = readRawByte()) >= 0) {
        result |= tmp << 14;
      } else {
        result |= (tmp & 0x7f) << 14;
        if ((tmp = readRawByte()) >= 0) {
          result |= tmp << 21;
        } else {
          result |= (tmp & 0x7f) << 21;
          result |= (tmp = readRawByte()) << 28;
          if (tmp < 0) {
            // Discard upper 32 bits.
            for (int i = 0; i < 5; i++) {
              if (readRawByte() >= 0) {
                return result;
              }
            }
            throw InvalidProtocolBufferException.malformedVarint();
          }
        }
      }
    }
    return result;
  }