Home | History | Annotate | Download | only in php

Lines Matching refs:offset

116      * @param $offset
120 public function writeLittleEndian($offset, $count, $data)
124 $this->_buffer[$offset + $i] = chr($data >> $i * 8);
128 $this->_buffer[$offset + $count - 1 - $i] = chr($data >> $i * 8);
136 * @param $offset
140 public function readLittleEndian($offset, $count, $force_bigendian = false)
142 $this->assertOffsetAndLength($offset, $count);
147 $r |= ord($this->_buffer[$offset + $i]) << $i * 8;
151 $r |= ord($this->_buffer[$offset + $count -1 - $i]) << $i * 8;
159 * @param $offset
162 public function assertOffsetAndLength($offset, $length)
164 if ($offset < 0 ||
165 $offset >= strlen($this->_buffer) ||
166 $offset + $length > strlen($this->_buffer)) {
167 throw new \OutOfRangeException(sprintf("offset: %d, length: %d, buffer; %d", $offset, $length, strlen($this->_buffer)));
172 * @param $offset
176 public function putSbyte($offset, $value)
181 $this->assertOffsetAndLength($offset, $length);
182 return $this->_buffer[$offset] = $value;
186 * @param $offset
190 public function putByte($offset, $value)
195 $this->assertOffsetAndLength($offset, $length);
196 return $this->_buffer[$offset] = $value;
200 * @param $offset
203 public function put($offset, $value)
206 $this->assertOffsetAndLength($offset, $length);
208 $this->_buffer[$offset + $i] = $value[$i];
213 * @param $offset
216 public function putShort($offset, $value)
220 $this->assertOffsetAndLength($offset, 2);
221 $this->writeLittleEndian($offset, 2, $value);
225 * @param $offset
228 public function putUshort($offset, $value)
232 $this->assertOffsetAndLength($offset, 2);
233 $this->writeLittleEndian($offset, 2, $value);
237 * @param $offset
240 public function putInt($offset, $value)
246 $this->assertOffsetAndLength($offset, 4);
247 $this->writeLittleEndian($offset, 4, $value);
251 * @param $offset
254 public function putUint($offset, $value)
260 $this->assertOffsetAndLength($offset, 4);
261 $this->writeLittleEndian($offset, 4, $value);
265 * @param $offset
268 public function putLong($offset, $value)
273 $this->assertOffsetAndLength($offset, 8);
274 $this->writeLittleEndian($offset, 8, $value);
278 * @param $offset
281 public function putUlong($offset, $value)
286 $this->assertOffsetAndLength($offset, 8);
287 $this->writeLittleEndian($offset, 8, $value);
291 * @param $offset
294 public function putFloat($offset, $value)
296 $this->assertOffsetAndLength($offset, 4);
300 $this->writeLittleEndian($offset, 4, $v[1]);
304 * @param $offset
307 public function putDouble($offset, $value)
309 $this->assertOffsetAndLength($offset, 8);
314 $this->writeLittleEndian($offset, 4, $v[1]);
315 $this->writeLittleEndian($offset + 4, 4, $v[2]);