Lines Matching refs:value

123  * @param {number} value The integer to convert.
125 jspb.BinaryEncoder.prototype.writeUnsignedVarint32 = function(value) {
126 goog.asserts.assert(value == Math.floor(value));
127 goog.asserts.assert((value >= 0) &&
128 (value < jspb.BinaryConstants.TWO_TO_32));
130 while (value > 127) {
131 this.buffer_.push((value & 0x7f) | 0x80);
132 value = value >>> 7;
135 this.buffer_.push(value);
142 * @param {number} value The integer to convert.
144 jspb.BinaryEncoder.prototype.writeSignedVarint32 = function(value) {
145 goog.asserts.assert(value == Math.floor(value));
146 goog.asserts.assert((value >= -jspb.BinaryConstants.TWO_TO_31) &&
147 (value < jspb.BinaryConstants.TWO_TO_31));
149 // Use the unsigned version if the value is not negative.
150 if (value >= 0) {
151 this.writeUnsignedVarint32(value);
157 this.buffer_.push((value & 0x7f) | 0x80);
158 value = value >> 7;
171 * @param {number} value The integer to convert.
173 jspb.BinaryEncoder.prototype.writeUnsignedVarint64 = function(value) {
174 goog.asserts.assert(value == Math.floor(value));
175 goog.asserts.assert((value >= 0) &&
176 (value < jspb.BinaryConstants.TWO_TO_64));
177 jspb.utils.splitInt64(value);
187 * @param {number} value The integer to convert.
189 jspb.BinaryEncoder.prototype.writeSignedVarint64 = function(value) {
190 goog.asserts.assert(value == Math.floor(value));
191 goog.asserts.assert((value >= -jspb.BinaryConstants.TWO_TO_63) &&
192 (value < jspb.BinaryConstants.TWO_TO_63));
193 jspb.utils.splitInt64(value);
202 * @param {number} value The integer to convert.
204 jspb.BinaryEncoder.prototype.writeZigzagVarint32 = function(value) {
205 goog.asserts.assert(value == Math.floor(value));
206 goog.asserts.assert((value >= -jspb.BinaryConstants.TWO_TO_31) &&
207 (value < jspb.BinaryConstants.TWO_TO_31));
208 this.writeUnsignedVarint32(((value << 1) ^ (value >> 31)) >>> 0);
216 * @param {number} value The integer to convert.
218 jspb.BinaryEncoder.prototype.writeZigzagVarint64 = function(value) {
219 goog.asserts.assert(value == Math.floor(value));
220 goog.asserts.assert((value >= -jspb.BinaryConstants.TWO_TO_63) &&
221 (value < jspb.BinaryConstants.TWO_TO_63));
222 jspb.utils.splitZigzag64(value);
232 * @param {string} value The integer to convert.
234 jspb.BinaryEncoder.prototype.writeZigzagVarint64String = function(value) {
235 this.writeZigzagVarintHash64(jspb.utils.decimalStringToHash64(value));
257 * @param {number} value The value to write.
259 jspb.BinaryEncoder.prototype.writeUint8 = function(value) {
260 goog.asserts.assert(value == Math.floor(value));
261 goog.asserts.assert((value >= 0) && (value < 256));
262 this.buffer_.push((value >>> 0) & 0xFF);
269 * @param {number} value The value to write.
271 jspb.BinaryEncoder.prototype.writeUint16 = function(value) {
272 goog.asserts.assert(value == Math.floor(value));
273 goog.asserts.assert((value >= 0) && (value < 65536));
274 this.buffer_.push((value >>> 0) & 0xFF);
275 this.buffer_.push((value >>> 8) & 0xFF);
282 * @param {number} value The value to write.
284 jspb.BinaryEncoder.prototype.writeUint32 = function(value) {
285 goog.asserts.assert(value == Math.floor(value));
286 goog.asserts.assert((value >= 0) &&
287 (value < jspb.BinaryConstants.TWO_TO_32));
288 this.buffer_.push((value >>> 0) & 0xFF);
289 this.buffer_.push((value >>> 8) & 0xFF);
290 this.buffer_.push((value >>> 16) & 0xFF);
291 this.buffer_.push((value >>> 24) & 0xFF);
298 * @param {number} value The value to write.
300 jspb.BinaryEncoder.prototype.writeUint64 = function(value) {
301 goog.asserts.assert(value == Math.floor(value));
302 goog.asserts.assert((value >= 0) &&
303 (value < jspb.BinaryConstants.TWO_TO_64));
304 jspb.utils.splitUint64(value);
313 * @param {number} value The value to write.
315 jspb.BinaryEncoder.prototype.writeInt8 = function(value) {
316 goog.asserts.assert(value == Math.floor(value));
317 goog.asserts.assert((value >= -128) && (value < 128));
318 this.buffer_.push((value >>> 0) & 0xFF);
325 * @param {number} value The value to write.
327 jspb.BinaryEncoder.prototype.writeInt16 = function(value) {
328 goog.asserts.assert(value == Math.floor(value));
329 goog.asserts.assert((value >= -32768) && (value < 32768));
330 this.buffer_.push((value >>> 0) & 0xFF);
331 this.buffer_.push((value >>> 8) & 0xFF);
338 * @param {number} value The value to write.
340 jspb.BinaryEncoder.prototype.writeInt32 = function(value) {
341 goog.asserts.assert(value == Math.floor(value));
342 goog.asserts.assert((value >= -jspb.BinaryConstants.TWO_TO_31) &&
343 (value < jspb.BinaryConstants.TWO_TO_31));
344 this.buffer_.push((value >>> 0) & 0xFF);
345 this.buffer_.push((value >>> 8) & 0xFF);
346 this.buffer_.push((value >>> 16) & 0xFF);
347 this.buffer_.push((value >>> 24) & 0xFF);
354 * @param {number} value The value to write.
356 jspb.BinaryEncoder.prototype.writeInt64 = function(value) {
357 goog.asserts.assert(value == Math.floor(value));
358 goog.asserts.assert((value >= -jspb.BinaryConstants.TWO_TO_63) &&
359 (value < jspb.BinaryConstants.TWO_TO_63));
360 jspb.utils.splitInt64(value);
368 * @param {string} value The value to write.
370 jspb.BinaryEncoder.prototype.writeInt64String = function(value) {
371 goog.asserts.assert(value == Math.floor(value));
372 goog.asserts.assert((+value >= -jspb.BinaryConstants.TWO_TO_63) &&
373 (+value < jspb.BinaryConstants.TWO_TO_63));
374 jspb.utils.splitHash64(jspb.utils.decimalStringToHash64(value));
380 * Writes a single-precision floating point value to the buffer. Numbers
382 * @param {number} value The value to write.
384 jspb.BinaryEncoder.prototype.writeFloat = function(value) {
386 value === Infinity || value === -Infinity || isNaN(value) ||
387 ((value >= -jspb.BinaryConstants.FLOAT32_MAX) &&
388 (value <= jspb.BinaryConstants.FLOAT32_MAX)));
389 jspb.utils.splitFloat32(value);
395 * Writes a double-precision floating point value to the buffer. As this is
397 * @param {number} value The value to write.
399 jspb.BinaryEncoder.prototype.writeDouble = function(value) {
401 value === Infinity || value === -Infinity || isNaN(value) ||
402 ((value >= -jspb.BinaryConstants.FLOAT64_MAX) &&
403 (value <= jspb.BinaryConstants.FLOAT64_MAX)));
404 jspb.utils.splitFloat64(value);
411 * Writes a boolean value to the buffer as a varint. We allow numbers as input
414 * @param {boolean|number} value The value to write.
416 jspb.BinaryEncoder.prototype.writeBool = function(value) {
417 goog.asserts.assert(typeof value === 'boolean' || typeof value === 'number');
418 this.buffer_.push(value ? 1 : 0);
423 * Writes an enum value to the buffer as a varint.
424 * @param {number} value The value to write.
426 jspb.BinaryEncoder.prototype.writeEnum = function(value) {
427 goog.asserts.assert(value == Math.floor(value));
428 goog.asserts.assert((value >= -jspb.BinaryConstants.TWO_TO_31) &&
429 (value < jspb.BinaryConstants.TWO_TO_31));
430 this.writeSignedVarint32(value);
470 * @param {string} value The string to write.
473 jspb.BinaryEncoder.prototype.writeString = function(value) {
476 for (var i = 0; i < value.length; i++) {
478 var c = value.charCodeAt(i);
487 if (c >= 0xD800 && c <= 0xDBFF && i + 1 < value.length) {
488 var second = value.charCodeAt(i + 1);