Lines Matching refs:value

103   // that those with a small absolute value will have smaller encoded values,
166 public static function readInt32(&$input, &$value)
168 return $input->readVarint32($value);
171 public static function readInt64(&$input, &$value)
173 $success = $input->readVarint64($value);
174 if (PHP_INT_SIZE == 4 && bccomp($value, "9223372036854775807") > 0) {
175 $value = bcsub($value, "18446744073709551616");
180 public static function readUint32(&$input, &$value)
182 return self::readInt32($input, $value);
185 public static function readUint64(&$input, &$value)
187 return self::readInt64($input, $value);
190 public static function readSint32(&$input, &$value)
192 if (!$input->readVarint32($value)) {
195 $value = GPBWire::zigZagDecode32($value);
199 public static function readSint64(&$input, &$value)
201 if (!$input->readVarint64($value)) {
204 $value = GPBWire::zigZagDecode64($value);
208 public static function readFixed32(&$input, &$value)
210 return $input->readLittleEndian32($value);
213 public static function readFixed64(&$input, &$value)
215 return $input->readLittleEndian64($value);
218 public static function readSfixed32(&$input, &$value)
220 if (!self::readFixed32($input, $value)) {
224 $value |= (-($value >> 31) << 32);
229 public static function readSfixed64(&$input, &$value)
231 $success = $input->readLittleEndian64($value);
232 if (PHP_INT_SIZE == 4 && bccomp($value, "9223372036854775807") > 0) {
233 $value = bcsub($value, "18446744073709551616");
238 public static function readFloat(&$input, &$value)
244 $value = unpack('f', $data)[1];
248 public static function readDouble(&$input, &$value)
254 $value = unpack('d', $data)[1];
258 public static function readBool(&$input, &$value)
260 if (!$input->readVarint64($value)) {
263 if ($value == 0) {
264 $value = false;
266 $value = true;
271 public static function readString(&$input, &$value)
274 return $input->readVarintSizeAsInt($length) && $input->readRaw($length, $value);
300 public static function writeInt32(&$output, $value)
302 return $output->writeVarint32($value, false);
305 public static function writeInt64(&$output, $value)
307 return $output->writeVarint64($value);
310 public static function writeUint32(&$output, $value)
312 return $output->writeVarint32($value, true);
315 public static function writeUint64(&$output, $value)
317 return $output->writeVarint64($value);
320 public static function writeSint32(&$output, $value)
322 $value = GPBWire::zigZagEncode32($value);
323 return $output->writeVarint32($value, true);
326 public static function writeSint64(&$output, $value)
328 $value = GPBWire::zigZagEncode64($value);
329 return $output->writeVarint64($value);
332 public static function writeFixed32(&$output, $value)
334 return $output->writeLittleEndian32($value);
337 public static function writeFixed64(&$output, $value)
339 return $output->writeLittleEndian64($value);
342 public static function writeSfixed32(&$output, $value)
344 return $output->writeLittleEndian32($value);
347 public static function writeSfixed64(&$output, $value)
349 return $output->writeLittleEndian64($value);
352 public static function writeBool(&$output, $value)
354 if ($value) {
361 public static function writeFloat(&$output, $value)
363 $data = pack("f", $value);
367 public static function writeDouble(&$output, $value)
369 $data = pack("d", $value);
373 public static function writeString(&$output, $value)
375 return self::writeBytes($output, $value);
378 public static function writeBytes(&$output, $value)
380 $size = strlen($value);
384 return $output->writeRaw($value, $size);
387 public static function writeMessage(&$output, $value)
389 $size = $value->byteSize();
393 return $value->serializeToStream($output);
407 public static function varint32Size($value, $sign_extended = false)
409 if ($value < 0) {
416 if ($value < (1 << 7)) {
419 if ($value < (1 << 14)) {
422 if ($value < (1 << 21)) {
425 if ($value < (1 << 28)) {
431 public static function sint32Size($value)
433 $value = self::zigZagEncode32($value);
434 return self::varint32Size($value);
437 public static function sint64Size($value)
439 $value = self::zigZagEncode64($value);
440 return self::varint64Size($value);
443 public static function varint64Size($value)
446 if (bccomp($value, 0) < 0 ||
447 bccomp($value, "9223372036854775807") > 0) {
450 if (bccomp($value, 1 << 7) < 0) {
453 if (bccomp($value, 1 << 14) < 0) {
456 if (bccomp($value, 1 << 21) < 0) {
459 if (bccomp($value, 1 << 28) < 0) {
462 if (bccomp($value, '34359738368') < 0) {
465 if (bccomp($value, '4398046511104') < 0) {
468 if (bccomp($value, '562949953421312') < 0) {
471 if (bccomp($value, '72057594037927936') < 0) {
476 if ($value < 0) {
479 if ($value < (1 << 7)) {
482 if ($value < (1 << 14)) {
485 if ($value < (1 << 21)) {
488 if ($value < (1 << 28)) {
491 if ($value < (1 << 35)) {
494 if ($value < (1 << 42)) {
497 if ($value < (1 << 49)) {
500 if ($value < (1 << 56)) {
508 $value,
524 if (!GPBWire::writeDouble($output, $value)) {
529 if (!GPBWire::writeFloat($output, $value)) {
534 if (!GPBWire::writeInt64($output, $value)) {
539 if (!GPBWire::writeUint64($output, $value)) {
544 if (!GPBWire::writeInt32($output, $value)) {
549 if (!GPBWire::writeFixed32($output, $value)) {
554 if (!GPBWire::writeFixed64($output, $value)) {
559 if (!GPBWire::writeBool($output, $value)) {
564 if (!GPBWire::writeString($output, $value)) {
573 if (!GPBWire::writeMessage($output, $value)) {
578 if (!GPBWire::writeBytes($output, $value)) {
583 if (PHP_INT_SIZE === 8 && $value < 0) {
584 $value += 4294967296;
586 if (!GPBWire::writeUint32($output, $value)) {
591 if (!GPBWire::writeInt32($output, $value)) {
596 if (!GPBWire::writeSfixed32($output, $value)) {
601 if (!GPBWire::writeSfixed64($output, $value)) {
606 if (!GPBWire::writeSint32($output, $value)) {
611 if (!GPBWire::writeSint64($output, $value)) {