@@ 114-120 (lines=7) @@ | ||
111 | $bytes = $this->readString(4); |
|
112 | $chunk = unpack('V', $bytes); |
|
113 | $int = array_pop($chunk); |
|
114 | if ($int < 0) { |
|
115 | $bits = decbin($int); |
|
116 | $int = bindec(substr($bits, 0, -1)) * 2; |
|
117 | if (substr($bits, -1) === '1') { |
|
118 | $int += 1; |
|
119 | } |
|
120 | } |
|
121 | ||
122 | return $int; |
|
123 | } |
|
@@ 164-170 (lines=7) @@ | ||
161 | if ($nativeUnpack) { |
|
162 | $chunk = unpack('P', $this->readString(8)); |
|
163 | $result = array_pop($chunk); |
|
164 | if ($result < 0) { |
|
165 | $bits = decbin($result); |
|
166 | $result = bindec(substr($bits, 0, -1)) * 2; |
|
167 | if (substr($bits, -1) === '1') { |
|
168 | $result += 1; |
|
169 | } |
|
170 | } |
|
171 | } else { |
|
172 | $n1 = $this->readUInt32(); |
|
173 | $n2 = $this->readUInt32(); |