Parsed: 112272

  private function readEBMLint() {
    $actual_offset = $this->current_offset - $this->EBMLbuffer_offset;

    // get length of integer
    $first_byte_int = ord($this->EBMLbuffer[$actual_offset]);
    if       (0x80 & $first_byte_int) {
      $length = 1;
    } elseif (0x40 & $first_byte_int) {
      $length = 2;
    } elseif (0x20 & $first_byte_int) {
      $length = 3;
    } elseif (0x10 & $first_byte_int) {
      $length = 4;
    } elseif (0x08 & $first_byte_int) {
      $length = 5;
    } elseif (0x04 & $first_byte_int) {
      $length = 6;
    } elseif (0x02 & $first_byte_int) {
      $length = 7;
    } elseif (0x01 & $first_byte_int) {
      $length = 8;
    } else {
      throw new Exception('invalid EBML integer (leading 0x00) at '.$this->current_offset);
    }

    // read
    $int_value = self::EBML2Int(substr($this->EBMLbuffer, $actual_offset, $length));
    $this->current_offset += $length;

    return $int_value;
  }