@vertexvis/stream-api 0.15.0 → 0.15.1-canary.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.cjs.js +29 -1327
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.esm.js +29 -1327
- package/dist/bundle.esm.js.map +1 -1
- package/package.json +4 -4
package/dist/bundle.cjs.js
CHANGED
|
@@ -19899,6 +19899,7 @@ const vertexvis = $root.vertexvis = (() => {
|
|
|
19899
19899
|
* @property {string|null} [jwt] StartStreamResult jwt
|
|
19900
19900
|
* @property {vertexvis.protobuf.stream.IOrientation|null} [worldOrientation] StartStreamResult worldOrientation
|
|
19901
19901
|
* @property {vertexvis.protobuf.stream.IToken|null} [token] StartStreamResult token
|
|
19902
|
+
* @property {vertexvis.protobuf.core.IUuid|null} [sceneId] StartStreamResult sceneId
|
|
19902
19903
|
*/
|
|
19903
19904
|
|
|
19904
19905
|
/**
|
|
@@ -19964,6 +19965,14 @@ const vertexvis = $root.vertexvis = (() => {
|
|
|
19964
19965
|
*/
|
|
19965
19966
|
StartStreamResult.prototype.token = null;
|
|
19966
19967
|
|
|
19968
|
+
/**
|
|
19969
|
+
* StartStreamResult sceneId.
|
|
19970
|
+
* @member {vertexvis.protobuf.core.IUuid|null|undefined} sceneId
|
|
19971
|
+
* @memberof vertexvis.protobuf.stream.StartStreamResult
|
|
19972
|
+
* @instance
|
|
19973
|
+
*/
|
|
19974
|
+
StartStreamResult.prototype.sceneId = null;
|
|
19975
|
+
|
|
19967
19976
|
/**
|
|
19968
19977
|
* Creates a new StartStreamResult instance using the specified properties.
|
|
19969
19978
|
* @function create
|
|
@@ -20000,6 +20009,8 @@ const vertexvis = $root.vertexvis = (() => {
|
|
|
20000
20009
|
$root.vertexvis.protobuf.stream.Orientation.encode(message.worldOrientation, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim();
|
|
20001
20010
|
if (message.token != null && Object.hasOwnProperty.call(message, "token"))
|
|
20002
20011
|
$root.vertexvis.protobuf.stream.Token.encode(message.token, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
|
|
20012
|
+
if (message.sceneId != null && Object.hasOwnProperty.call(message, "sceneId"))
|
|
20013
|
+
$root.vertexvis.protobuf.core.Uuid.encode(message.sceneId, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim();
|
|
20003
20014
|
return writer;
|
|
20004
20015
|
};
|
|
20005
20016
|
|
|
@@ -20052,6 +20063,9 @@ const vertexvis = $root.vertexvis = (() => {
|
|
|
20052
20063
|
case 6:
|
|
20053
20064
|
message.token = $root.vertexvis.protobuf.stream.Token.decode(reader, reader.uint32());
|
|
20054
20065
|
break;
|
|
20066
|
+
case 7:
|
|
20067
|
+
message.sceneId = $root.vertexvis.protobuf.core.Uuid.decode(reader, reader.uint32());
|
|
20068
|
+
break;
|
|
20055
20069
|
default:
|
|
20056
20070
|
reader.skipType(tag & 7);
|
|
20057
20071
|
break;
|
|
@@ -20115,6 +20129,11 @@ const vertexvis = $root.vertexvis = (() => {
|
|
|
20115
20129
|
if (error)
|
|
20116
20130
|
return "token." + error;
|
|
20117
20131
|
}
|
|
20132
|
+
if (message.sceneId != null && message.hasOwnProperty("sceneId")) {
|
|
20133
|
+
let error = $root.vertexvis.protobuf.core.Uuid.verify(message.sceneId);
|
|
20134
|
+
if (error)
|
|
20135
|
+
return "sceneId." + error;
|
|
20136
|
+
}
|
|
20118
20137
|
return null;
|
|
20119
20138
|
};
|
|
20120
20139
|
|
|
@@ -20157,6 +20176,11 @@ const vertexvis = $root.vertexvis = (() => {
|
|
|
20157
20176
|
throw TypeError(".vertexvis.protobuf.stream.StartStreamResult.token: object expected");
|
|
20158
20177
|
message.token = $root.vertexvis.protobuf.stream.Token.fromObject(object.token);
|
|
20159
20178
|
}
|
|
20179
|
+
if (object.sceneId != null) {
|
|
20180
|
+
if (typeof object.sceneId !== "object")
|
|
20181
|
+
throw TypeError(".vertexvis.protobuf.stream.StartStreamResult.sceneId: object expected");
|
|
20182
|
+
message.sceneId = $root.vertexvis.protobuf.core.Uuid.fromObject(object.sceneId);
|
|
20183
|
+
}
|
|
20160
20184
|
return message;
|
|
20161
20185
|
};
|
|
20162
20186
|
|
|
@@ -20180,6 +20204,7 @@ const vertexvis = $root.vertexvis = (() => {
|
|
|
20180
20204
|
object.jwt = "";
|
|
20181
20205
|
object.worldOrientation = null;
|
|
20182
20206
|
object.token = null;
|
|
20207
|
+
object.sceneId = null;
|
|
20183
20208
|
}
|
|
20184
20209
|
if (message.streamId != null && message.hasOwnProperty("streamId"))
|
|
20185
20210
|
object.streamId = $root.vertexvis.protobuf.core.Uuid.toObject(message.streamId, options);
|
|
@@ -20193,6 +20218,8 @@ const vertexvis = $root.vertexvis = (() => {
|
|
|
20193
20218
|
object.worldOrientation = $root.vertexvis.protobuf.stream.Orientation.toObject(message.worldOrientation, options);
|
|
20194
20219
|
if (message.token != null && message.hasOwnProperty("token"))
|
|
20195
20220
|
object.token = $root.vertexvis.protobuf.stream.Token.toObject(message.token, options);
|
|
20221
|
+
if (message.sceneId != null && message.hasOwnProperty("sceneId"))
|
|
20222
|
+
object.sceneId = $root.vertexvis.protobuf.core.Uuid.toObject(message.sceneId, options);
|
|
20196
20223
|
return object;
|
|
20197
20224
|
};
|
|
20198
20225
|
|
|
@@ -35311,1330 +35338,6 @@ function defineSettings(getter, defaults, builder) {
|
|
|
35311
35338
|
};
|
|
35312
35339
|
}
|
|
35313
35340
|
|
|
35314
|
-
var long = Long;
|
|
35315
|
-
|
|
35316
|
-
/**
|
|
35317
|
-
* wasm optimizations, to do native i64 multiplication and divide
|
|
35318
|
-
*/
|
|
35319
|
-
var wasm = null;
|
|
35320
|
-
|
|
35321
|
-
try {
|
|
35322
|
-
wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([
|
|
35323
|
-
0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11
|
|
35324
|
-
])), {}).exports;
|
|
35325
|
-
} catch (e) {
|
|
35326
|
-
// no wasm support :(
|
|
35327
|
-
}
|
|
35328
|
-
|
|
35329
|
-
/**
|
|
35330
|
-
* Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
|
|
35331
|
-
* See the from* functions below for more convenient ways of constructing Longs.
|
|
35332
|
-
* @exports Long
|
|
35333
|
-
* @class A Long class for representing a 64 bit two's-complement integer value.
|
|
35334
|
-
* @param {number} low The low (signed) 32 bits of the long
|
|
35335
|
-
* @param {number} high The high (signed) 32 bits of the long
|
|
35336
|
-
* @param {boolean=} unsigned Whether unsigned or not, defaults to signed
|
|
35337
|
-
* @constructor
|
|
35338
|
-
*/
|
|
35339
|
-
function Long(low, high, unsigned) {
|
|
35340
|
-
|
|
35341
|
-
/**
|
|
35342
|
-
* The low 32 bits as a signed value.
|
|
35343
|
-
* @type {number}
|
|
35344
|
-
*/
|
|
35345
|
-
this.low = low | 0;
|
|
35346
|
-
|
|
35347
|
-
/**
|
|
35348
|
-
* The high 32 bits as a signed value.
|
|
35349
|
-
* @type {number}
|
|
35350
|
-
*/
|
|
35351
|
-
this.high = high | 0;
|
|
35352
|
-
|
|
35353
|
-
/**
|
|
35354
|
-
* Whether unsigned or not.
|
|
35355
|
-
* @type {boolean}
|
|
35356
|
-
*/
|
|
35357
|
-
this.unsigned = !!unsigned;
|
|
35358
|
-
}
|
|
35359
|
-
|
|
35360
|
-
// The internal representation of a long is the two given signed, 32-bit values.
|
|
35361
|
-
// We use 32-bit pieces because these are the size of integers on which
|
|
35362
|
-
// Javascript performs bit-operations. For operations like addition and
|
|
35363
|
-
// multiplication, we split each number into 16 bit pieces, which can easily be
|
|
35364
|
-
// multiplied within Javascript's floating-point representation without overflow
|
|
35365
|
-
// or change in sign.
|
|
35366
|
-
//
|
|
35367
|
-
// In the algorithms below, we frequently reduce the negative case to the
|
|
35368
|
-
// positive case by negating the input(s) and then post-processing the result.
|
|
35369
|
-
// Note that we must ALWAYS check specially whether those values are MIN_VALUE
|
|
35370
|
-
// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
|
|
35371
|
-
// a positive number, it overflows back into a negative). Not handling this
|
|
35372
|
-
// case would often result in infinite recursion.
|
|
35373
|
-
//
|
|
35374
|
-
// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
|
|
35375
|
-
// methods on which they depend.
|
|
35376
|
-
|
|
35377
|
-
/**
|
|
35378
|
-
* An indicator used to reliably determine if an object is a Long or not.
|
|
35379
|
-
* @type {boolean}
|
|
35380
|
-
* @const
|
|
35381
|
-
* @private
|
|
35382
|
-
*/
|
|
35383
|
-
Long.prototype.__isLong__;
|
|
35384
|
-
|
|
35385
|
-
Object.defineProperty(Long.prototype, "__isLong__", { value: true });
|
|
35386
|
-
|
|
35387
|
-
/**
|
|
35388
|
-
* @function
|
|
35389
|
-
* @param {*} obj Object
|
|
35390
|
-
* @returns {boolean}
|
|
35391
|
-
* @inner
|
|
35392
|
-
*/
|
|
35393
|
-
function isLong(obj) {
|
|
35394
|
-
return (obj && obj["__isLong__"]) === true;
|
|
35395
|
-
}
|
|
35396
|
-
|
|
35397
|
-
/**
|
|
35398
|
-
* Tests if the specified object is a Long.
|
|
35399
|
-
* @function
|
|
35400
|
-
* @param {*} obj Object
|
|
35401
|
-
* @returns {boolean}
|
|
35402
|
-
*/
|
|
35403
|
-
Long.isLong = isLong;
|
|
35404
|
-
|
|
35405
|
-
/**
|
|
35406
|
-
* A cache of the Long representations of small integer values.
|
|
35407
|
-
* @type {!Object}
|
|
35408
|
-
* @inner
|
|
35409
|
-
*/
|
|
35410
|
-
var INT_CACHE = {};
|
|
35411
|
-
|
|
35412
|
-
/**
|
|
35413
|
-
* A cache of the Long representations of small unsigned integer values.
|
|
35414
|
-
* @type {!Object}
|
|
35415
|
-
* @inner
|
|
35416
|
-
*/
|
|
35417
|
-
var UINT_CACHE = {};
|
|
35418
|
-
|
|
35419
|
-
/**
|
|
35420
|
-
* @param {number} value
|
|
35421
|
-
* @param {boolean=} unsigned
|
|
35422
|
-
* @returns {!Long}
|
|
35423
|
-
* @inner
|
|
35424
|
-
*/
|
|
35425
|
-
function fromInt(value, unsigned) {
|
|
35426
|
-
var obj, cachedObj, cache;
|
|
35427
|
-
if (unsigned) {
|
|
35428
|
-
value >>>= 0;
|
|
35429
|
-
if (cache = (0 <= value && value < 256)) {
|
|
35430
|
-
cachedObj = UINT_CACHE[value];
|
|
35431
|
-
if (cachedObj)
|
|
35432
|
-
return cachedObj;
|
|
35433
|
-
}
|
|
35434
|
-
obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);
|
|
35435
|
-
if (cache)
|
|
35436
|
-
UINT_CACHE[value] = obj;
|
|
35437
|
-
return obj;
|
|
35438
|
-
} else {
|
|
35439
|
-
value |= 0;
|
|
35440
|
-
if (cache = (-128 <= value && value < 128)) {
|
|
35441
|
-
cachedObj = INT_CACHE[value];
|
|
35442
|
-
if (cachedObj)
|
|
35443
|
-
return cachedObj;
|
|
35444
|
-
}
|
|
35445
|
-
obj = fromBits(value, value < 0 ? -1 : 0, false);
|
|
35446
|
-
if (cache)
|
|
35447
|
-
INT_CACHE[value] = obj;
|
|
35448
|
-
return obj;
|
|
35449
|
-
}
|
|
35450
|
-
}
|
|
35451
|
-
|
|
35452
|
-
/**
|
|
35453
|
-
* Returns a Long representing the given 32 bit integer value.
|
|
35454
|
-
* @function
|
|
35455
|
-
* @param {number} value The 32 bit integer in question
|
|
35456
|
-
* @param {boolean=} unsigned Whether unsigned or not, defaults to signed
|
|
35457
|
-
* @returns {!Long} The corresponding Long value
|
|
35458
|
-
*/
|
|
35459
|
-
Long.fromInt = fromInt;
|
|
35460
|
-
|
|
35461
|
-
/**
|
|
35462
|
-
* @param {number} value
|
|
35463
|
-
* @param {boolean=} unsigned
|
|
35464
|
-
* @returns {!Long}
|
|
35465
|
-
* @inner
|
|
35466
|
-
*/
|
|
35467
|
-
function fromNumber(value, unsigned) {
|
|
35468
|
-
if (isNaN(value))
|
|
35469
|
-
return unsigned ? UZERO : ZERO;
|
|
35470
|
-
if (unsigned) {
|
|
35471
|
-
if (value < 0)
|
|
35472
|
-
return UZERO;
|
|
35473
|
-
if (value >= TWO_PWR_64_DBL)
|
|
35474
|
-
return MAX_UNSIGNED_VALUE;
|
|
35475
|
-
} else {
|
|
35476
|
-
if (value <= -TWO_PWR_63_DBL)
|
|
35477
|
-
return MIN_VALUE;
|
|
35478
|
-
if (value + 1 >= TWO_PWR_63_DBL)
|
|
35479
|
-
return MAX_VALUE;
|
|
35480
|
-
}
|
|
35481
|
-
if (value < 0)
|
|
35482
|
-
return fromNumber(-value, unsigned).neg();
|
|
35483
|
-
return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
|
|
35484
|
-
}
|
|
35485
|
-
|
|
35486
|
-
/**
|
|
35487
|
-
* Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
|
|
35488
|
-
* @function
|
|
35489
|
-
* @param {number} value The number in question
|
|
35490
|
-
* @param {boolean=} unsigned Whether unsigned or not, defaults to signed
|
|
35491
|
-
* @returns {!Long} The corresponding Long value
|
|
35492
|
-
*/
|
|
35493
|
-
Long.fromNumber = fromNumber;
|
|
35494
|
-
|
|
35495
|
-
/**
|
|
35496
|
-
* @param {number} lowBits
|
|
35497
|
-
* @param {number} highBits
|
|
35498
|
-
* @param {boolean=} unsigned
|
|
35499
|
-
* @returns {!Long}
|
|
35500
|
-
* @inner
|
|
35501
|
-
*/
|
|
35502
|
-
function fromBits(lowBits, highBits, unsigned) {
|
|
35503
|
-
return new Long(lowBits, highBits, unsigned);
|
|
35504
|
-
}
|
|
35505
|
-
|
|
35506
|
-
/**
|
|
35507
|
-
* Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
|
|
35508
|
-
* assumed to use 32 bits.
|
|
35509
|
-
* @function
|
|
35510
|
-
* @param {number} lowBits The low 32 bits
|
|
35511
|
-
* @param {number} highBits The high 32 bits
|
|
35512
|
-
* @param {boolean=} unsigned Whether unsigned or not, defaults to signed
|
|
35513
|
-
* @returns {!Long} The corresponding Long value
|
|
35514
|
-
*/
|
|
35515
|
-
Long.fromBits = fromBits;
|
|
35516
|
-
|
|
35517
|
-
/**
|
|
35518
|
-
* @function
|
|
35519
|
-
* @param {number} base
|
|
35520
|
-
* @param {number} exponent
|
|
35521
|
-
* @returns {number}
|
|
35522
|
-
* @inner
|
|
35523
|
-
*/
|
|
35524
|
-
var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)
|
|
35525
|
-
|
|
35526
|
-
/**
|
|
35527
|
-
* @param {string} str
|
|
35528
|
-
* @param {(boolean|number)=} unsigned
|
|
35529
|
-
* @param {number=} radix
|
|
35530
|
-
* @returns {!Long}
|
|
35531
|
-
* @inner
|
|
35532
|
-
*/
|
|
35533
|
-
function fromString(str, unsigned, radix) {
|
|
35534
|
-
if (str.length === 0)
|
|
35535
|
-
throw Error('empty string');
|
|
35536
|
-
if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
|
|
35537
|
-
return ZERO;
|
|
35538
|
-
if (typeof unsigned === 'number') {
|
|
35539
|
-
// For goog.math.long compatibility
|
|
35540
|
-
radix = unsigned,
|
|
35541
|
-
unsigned = false;
|
|
35542
|
-
} else {
|
|
35543
|
-
unsigned = !! unsigned;
|
|
35544
|
-
}
|
|
35545
|
-
radix = radix || 10;
|
|
35546
|
-
if (radix < 2 || 36 < radix)
|
|
35547
|
-
throw RangeError('radix');
|
|
35548
|
-
|
|
35549
|
-
var p;
|
|
35550
|
-
if ((p = str.indexOf('-')) > 0)
|
|
35551
|
-
throw Error('interior hyphen');
|
|
35552
|
-
else if (p === 0) {
|
|
35553
|
-
return fromString(str.substring(1), unsigned, radix).neg();
|
|
35554
|
-
}
|
|
35555
|
-
|
|
35556
|
-
// Do several (8) digits each time through the loop, so as to
|
|
35557
|
-
// minimize the calls to the very expensive emulated div.
|
|
35558
|
-
var radixToPower = fromNumber(pow_dbl(radix, 8));
|
|
35559
|
-
|
|
35560
|
-
var result = ZERO;
|
|
35561
|
-
for (var i = 0; i < str.length; i += 8) {
|
|
35562
|
-
var size = Math.min(8, str.length - i),
|
|
35563
|
-
value = parseInt(str.substring(i, i + size), radix);
|
|
35564
|
-
if (size < 8) {
|
|
35565
|
-
var power = fromNumber(pow_dbl(radix, size));
|
|
35566
|
-
result = result.mul(power).add(fromNumber(value));
|
|
35567
|
-
} else {
|
|
35568
|
-
result = result.mul(radixToPower);
|
|
35569
|
-
result = result.add(fromNumber(value));
|
|
35570
|
-
}
|
|
35571
|
-
}
|
|
35572
|
-
result.unsigned = unsigned;
|
|
35573
|
-
return result;
|
|
35574
|
-
}
|
|
35575
|
-
|
|
35576
|
-
/**
|
|
35577
|
-
* Returns a Long representation of the given string, written using the specified radix.
|
|
35578
|
-
* @function
|
|
35579
|
-
* @param {string} str The textual representation of the Long
|
|
35580
|
-
* @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed
|
|
35581
|
-
* @param {number=} radix The radix in which the text is written (2-36), defaults to 10
|
|
35582
|
-
* @returns {!Long} The corresponding Long value
|
|
35583
|
-
*/
|
|
35584
|
-
Long.fromString = fromString;
|
|
35585
|
-
|
|
35586
|
-
/**
|
|
35587
|
-
* @function
|
|
35588
|
-
* @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
|
|
35589
|
-
* @param {boolean=} unsigned
|
|
35590
|
-
* @returns {!Long}
|
|
35591
|
-
* @inner
|
|
35592
|
-
*/
|
|
35593
|
-
function fromValue(val, unsigned) {
|
|
35594
|
-
if (typeof val === 'number')
|
|
35595
|
-
return fromNumber(val, unsigned);
|
|
35596
|
-
if (typeof val === 'string')
|
|
35597
|
-
return fromString(val, unsigned);
|
|
35598
|
-
// Throws for non-objects, converts non-instanceof Long:
|
|
35599
|
-
return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);
|
|
35600
|
-
}
|
|
35601
|
-
|
|
35602
|
-
/**
|
|
35603
|
-
* Converts the specified value to a Long using the appropriate from* function for its type.
|
|
35604
|
-
* @function
|
|
35605
|
-
* @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
|
|
35606
|
-
* @param {boolean=} unsigned Whether unsigned or not, defaults to signed
|
|
35607
|
-
* @returns {!Long}
|
|
35608
|
-
*/
|
|
35609
|
-
Long.fromValue = fromValue;
|
|
35610
|
-
|
|
35611
|
-
// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
|
|
35612
|
-
// no runtime penalty for these.
|
|
35613
|
-
|
|
35614
|
-
/**
|
|
35615
|
-
* @type {number}
|
|
35616
|
-
* @const
|
|
35617
|
-
* @inner
|
|
35618
|
-
*/
|
|
35619
|
-
var TWO_PWR_16_DBL = 1 << 16;
|
|
35620
|
-
|
|
35621
|
-
/**
|
|
35622
|
-
* @type {number}
|
|
35623
|
-
* @const
|
|
35624
|
-
* @inner
|
|
35625
|
-
*/
|
|
35626
|
-
var TWO_PWR_24_DBL = 1 << 24;
|
|
35627
|
-
|
|
35628
|
-
/**
|
|
35629
|
-
* @type {number}
|
|
35630
|
-
* @const
|
|
35631
|
-
* @inner
|
|
35632
|
-
*/
|
|
35633
|
-
var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
|
|
35634
|
-
|
|
35635
|
-
/**
|
|
35636
|
-
* @type {number}
|
|
35637
|
-
* @const
|
|
35638
|
-
* @inner
|
|
35639
|
-
*/
|
|
35640
|
-
var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
|
|
35641
|
-
|
|
35642
|
-
/**
|
|
35643
|
-
* @type {number}
|
|
35644
|
-
* @const
|
|
35645
|
-
* @inner
|
|
35646
|
-
*/
|
|
35647
|
-
var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
|
|
35648
|
-
|
|
35649
|
-
/**
|
|
35650
|
-
* @type {!Long}
|
|
35651
|
-
* @const
|
|
35652
|
-
* @inner
|
|
35653
|
-
*/
|
|
35654
|
-
var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
|
|
35655
|
-
|
|
35656
|
-
/**
|
|
35657
|
-
* @type {!Long}
|
|
35658
|
-
* @inner
|
|
35659
|
-
*/
|
|
35660
|
-
var ZERO = fromInt(0);
|
|
35661
|
-
|
|
35662
|
-
/**
|
|
35663
|
-
* Signed zero.
|
|
35664
|
-
* @type {!Long}
|
|
35665
|
-
*/
|
|
35666
|
-
Long.ZERO = ZERO;
|
|
35667
|
-
|
|
35668
|
-
/**
|
|
35669
|
-
* @type {!Long}
|
|
35670
|
-
* @inner
|
|
35671
|
-
*/
|
|
35672
|
-
var UZERO = fromInt(0, true);
|
|
35673
|
-
|
|
35674
|
-
/**
|
|
35675
|
-
* Unsigned zero.
|
|
35676
|
-
* @type {!Long}
|
|
35677
|
-
*/
|
|
35678
|
-
Long.UZERO = UZERO;
|
|
35679
|
-
|
|
35680
|
-
/**
|
|
35681
|
-
* @type {!Long}
|
|
35682
|
-
* @inner
|
|
35683
|
-
*/
|
|
35684
|
-
var ONE = fromInt(1);
|
|
35685
|
-
|
|
35686
|
-
/**
|
|
35687
|
-
* Signed one.
|
|
35688
|
-
* @type {!Long}
|
|
35689
|
-
*/
|
|
35690
|
-
Long.ONE = ONE;
|
|
35691
|
-
|
|
35692
|
-
/**
|
|
35693
|
-
* @type {!Long}
|
|
35694
|
-
* @inner
|
|
35695
|
-
*/
|
|
35696
|
-
var UONE = fromInt(1, true);
|
|
35697
|
-
|
|
35698
|
-
/**
|
|
35699
|
-
* Unsigned one.
|
|
35700
|
-
* @type {!Long}
|
|
35701
|
-
*/
|
|
35702
|
-
Long.UONE = UONE;
|
|
35703
|
-
|
|
35704
|
-
/**
|
|
35705
|
-
* @type {!Long}
|
|
35706
|
-
* @inner
|
|
35707
|
-
*/
|
|
35708
|
-
var NEG_ONE = fromInt(-1);
|
|
35709
|
-
|
|
35710
|
-
/**
|
|
35711
|
-
* Signed negative one.
|
|
35712
|
-
* @type {!Long}
|
|
35713
|
-
*/
|
|
35714
|
-
Long.NEG_ONE = NEG_ONE;
|
|
35715
|
-
|
|
35716
|
-
/**
|
|
35717
|
-
* @type {!Long}
|
|
35718
|
-
* @inner
|
|
35719
|
-
*/
|
|
35720
|
-
var MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);
|
|
35721
|
-
|
|
35722
|
-
/**
|
|
35723
|
-
* Maximum signed value.
|
|
35724
|
-
* @type {!Long}
|
|
35725
|
-
*/
|
|
35726
|
-
Long.MAX_VALUE = MAX_VALUE;
|
|
35727
|
-
|
|
35728
|
-
/**
|
|
35729
|
-
* @type {!Long}
|
|
35730
|
-
* @inner
|
|
35731
|
-
*/
|
|
35732
|
-
var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);
|
|
35733
|
-
|
|
35734
|
-
/**
|
|
35735
|
-
* Maximum unsigned value.
|
|
35736
|
-
* @type {!Long}
|
|
35737
|
-
*/
|
|
35738
|
-
Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
|
|
35739
|
-
|
|
35740
|
-
/**
|
|
35741
|
-
* @type {!Long}
|
|
35742
|
-
* @inner
|
|
35743
|
-
*/
|
|
35744
|
-
var MIN_VALUE = fromBits(0, 0x80000000|0, false);
|
|
35745
|
-
|
|
35746
|
-
/**
|
|
35747
|
-
* Minimum signed value.
|
|
35748
|
-
* @type {!Long}
|
|
35749
|
-
*/
|
|
35750
|
-
Long.MIN_VALUE = MIN_VALUE;
|
|
35751
|
-
|
|
35752
|
-
/**
|
|
35753
|
-
* @alias Long.prototype
|
|
35754
|
-
* @inner
|
|
35755
|
-
*/
|
|
35756
|
-
var LongPrototype = Long.prototype;
|
|
35757
|
-
|
|
35758
|
-
/**
|
|
35759
|
-
* Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
|
|
35760
|
-
* @returns {number}
|
|
35761
|
-
*/
|
|
35762
|
-
LongPrototype.toInt = function toInt() {
|
|
35763
|
-
return this.unsigned ? this.low >>> 0 : this.low;
|
|
35764
|
-
};
|
|
35765
|
-
|
|
35766
|
-
/**
|
|
35767
|
-
* Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
|
|
35768
|
-
* @returns {number}
|
|
35769
|
-
*/
|
|
35770
|
-
LongPrototype.toNumber = function toNumber() {
|
|
35771
|
-
if (this.unsigned)
|
|
35772
|
-
return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);
|
|
35773
|
-
return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
|
|
35774
|
-
};
|
|
35775
|
-
|
|
35776
|
-
/**
|
|
35777
|
-
* Converts the Long to a string written in the specified radix.
|
|
35778
|
-
* @param {number=} radix Radix (2-36), defaults to 10
|
|
35779
|
-
* @returns {string}
|
|
35780
|
-
* @override
|
|
35781
|
-
* @throws {RangeError} If `radix` is out of range
|
|
35782
|
-
*/
|
|
35783
|
-
LongPrototype.toString = function toString(radix) {
|
|
35784
|
-
radix = radix || 10;
|
|
35785
|
-
if (radix < 2 || 36 < radix)
|
|
35786
|
-
throw RangeError('radix');
|
|
35787
|
-
if (this.isZero())
|
|
35788
|
-
return '0';
|
|
35789
|
-
if (this.isNegative()) { // Unsigned Longs are never negative
|
|
35790
|
-
if (this.eq(MIN_VALUE)) {
|
|
35791
|
-
// We need to change the Long value before it can be negated, so we remove
|
|
35792
|
-
// the bottom-most digit in this base and then recurse to do the rest.
|
|
35793
|
-
var radixLong = fromNumber(radix),
|
|
35794
|
-
div = this.div(radixLong),
|
|
35795
|
-
rem1 = div.mul(radixLong).sub(this);
|
|
35796
|
-
return div.toString(radix) + rem1.toInt().toString(radix);
|
|
35797
|
-
} else
|
|
35798
|
-
return '-' + this.neg().toString(radix);
|
|
35799
|
-
}
|
|
35800
|
-
|
|
35801
|
-
// Do several (6) digits each time through the loop, so as to
|
|
35802
|
-
// minimize the calls to the very expensive emulated div.
|
|
35803
|
-
var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),
|
|
35804
|
-
rem = this;
|
|
35805
|
-
var result = '';
|
|
35806
|
-
while (true) {
|
|
35807
|
-
var remDiv = rem.div(radixToPower),
|
|
35808
|
-
intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,
|
|
35809
|
-
digits = intval.toString(radix);
|
|
35810
|
-
rem = remDiv;
|
|
35811
|
-
if (rem.isZero())
|
|
35812
|
-
return digits + result;
|
|
35813
|
-
else {
|
|
35814
|
-
while (digits.length < 6)
|
|
35815
|
-
digits = '0' + digits;
|
|
35816
|
-
result = '' + digits + result;
|
|
35817
|
-
}
|
|
35818
|
-
}
|
|
35819
|
-
};
|
|
35820
|
-
|
|
35821
|
-
/**
|
|
35822
|
-
* Gets the high 32 bits as a signed integer.
|
|
35823
|
-
* @returns {number} Signed high bits
|
|
35824
|
-
*/
|
|
35825
|
-
LongPrototype.getHighBits = function getHighBits() {
|
|
35826
|
-
return this.high;
|
|
35827
|
-
};
|
|
35828
|
-
|
|
35829
|
-
/**
|
|
35830
|
-
* Gets the high 32 bits as an unsigned integer.
|
|
35831
|
-
* @returns {number} Unsigned high bits
|
|
35832
|
-
*/
|
|
35833
|
-
LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
|
|
35834
|
-
return this.high >>> 0;
|
|
35835
|
-
};
|
|
35836
|
-
|
|
35837
|
-
/**
|
|
35838
|
-
* Gets the low 32 bits as a signed integer.
|
|
35839
|
-
* @returns {number} Signed low bits
|
|
35840
|
-
*/
|
|
35841
|
-
LongPrototype.getLowBits = function getLowBits() {
|
|
35842
|
-
return this.low;
|
|
35843
|
-
};
|
|
35844
|
-
|
|
35845
|
-
/**
|
|
35846
|
-
* Gets the low 32 bits as an unsigned integer.
|
|
35847
|
-
* @returns {number} Unsigned low bits
|
|
35848
|
-
*/
|
|
35849
|
-
LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
|
|
35850
|
-
return this.low >>> 0;
|
|
35851
|
-
};
|
|
35852
|
-
|
|
35853
|
-
/**
|
|
35854
|
-
* Gets the number of bits needed to represent the absolute value of this Long.
|
|
35855
|
-
* @returns {number}
|
|
35856
|
-
*/
|
|
35857
|
-
LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
|
|
35858
|
-
if (this.isNegative()) // Unsigned Longs are never negative
|
|
35859
|
-
return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
|
|
35860
|
-
var val = this.high != 0 ? this.high : this.low;
|
|
35861
|
-
for (var bit = 31; bit > 0; bit--)
|
|
35862
|
-
if ((val & (1 << bit)) != 0)
|
|
35863
|
-
break;
|
|
35864
|
-
return this.high != 0 ? bit + 33 : bit + 1;
|
|
35865
|
-
};
|
|
35866
|
-
|
|
35867
|
-
/**
|
|
35868
|
-
* Tests if this Long's value equals zero.
|
|
35869
|
-
* @returns {boolean}
|
|
35870
|
-
*/
|
|
35871
|
-
LongPrototype.isZero = function isZero() {
|
|
35872
|
-
return this.high === 0 && this.low === 0;
|
|
35873
|
-
};
|
|
35874
|
-
|
|
35875
|
-
/**
|
|
35876
|
-
* Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.
|
|
35877
|
-
* @returns {boolean}
|
|
35878
|
-
*/
|
|
35879
|
-
LongPrototype.eqz = LongPrototype.isZero;
|
|
35880
|
-
|
|
35881
|
-
/**
|
|
35882
|
-
* Tests if this Long's value is negative.
|
|
35883
|
-
* @returns {boolean}
|
|
35884
|
-
*/
|
|
35885
|
-
LongPrototype.isNegative = function isNegative() {
|
|
35886
|
-
return !this.unsigned && this.high < 0;
|
|
35887
|
-
};
|
|
35888
|
-
|
|
35889
|
-
/**
|
|
35890
|
-
* Tests if this Long's value is positive.
|
|
35891
|
-
* @returns {boolean}
|
|
35892
|
-
*/
|
|
35893
|
-
LongPrototype.isPositive = function isPositive() {
|
|
35894
|
-
return this.unsigned || this.high >= 0;
|
|
35895
|
-
};
|
|
35896
|
-
|
|
35897
|
-
/**
|
|
35898
|
-
* Tests if this Long's value is odd.
|
|
35899
|
-
* @returns {boolean}
|
|
35900
|
-
*/
|
|
35901
|
-
LongPrototype.isOdd = function isOdd() {
|
|
35902
|
-
return (this.low & 1) === 1;
|
|
35903
|
-
};
|
|
35904
|
-
|
|
35905
|
-
/**
|
|
35906
|
-
* Tests if this Long's value is even.
|
|
35907
|
-
* @returns {boolean}
|
|
35908
|
-
*/
|
|
35909
|
-
LongPrototype.isEven = function isEven() {
|
|
35910
|
-
return (this.low & 1) === 0;
|
|
35911
|
-
};
|
|
35912
|
-
|
|
35913
|
-
/**
|
|
35914
|
-
* Tests if this Long's value equals the specified's.
|
|
35915
|
-
* @param {!Long|number|string} other Other value
|
|
35916
|
-
* @returns {boolean}
|
|
35917
|
-
*/
|
|
35918
|
-
LongPrototype.equals = function equals(other) {
|
|
35919
|
-
if (!isLong(other))
|
|
35920
|
-
other = fromValue(other);
|
|
35921
|
-
if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)
|
|
35922
|
-
return false;
|
|
35923
|
-
return this.high === other.high && this.low === other.low;
|
|
35924
|
-
};
|
|
35925
|
-
|
|
35926
|
-
/**
|
|
35927
|
-
* Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
|
|
35928
|
-
* @function
|
|
35929
|
-
* @param {!Long|number|string} other Other value
|
|
35930
|
-
* @returns {boolean}
|
|
35931
|
-
*/
|
|
35932
|
-
LongPrototype.eq = LongPrototype.equals;
|
|
35933
|
-
|
|
35934
|
-
/**
|
|
35935
|
-
* Tests if this Long's value differs from the specified's.
|
|
35936
|
-
* @param {!Long|number|string} other Other value
|
|
35937
|
-
* @returns {boolean}
|
|
35938
|
-
*/
|
|
35939
|
-
LongPrototype.notEquals = function notEquals(other) {
|
|
35940
|
-
return !this.eq(/* validates */ other);
|
|
35941
|
-
};
|
|
35942
|
-
|
|
35943
|
-
/**
|
|
35944
|
-
* Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
|
|
35945
|
-
* @function
|
|
35946
|
-
* @param {!Long|number|string} other Other value
|
|
35947
|
-
* @returns {boolean}
|
|
35948
|
-
*/
|
|
35949
|
-
LongPrototype.neq = LongPrototype.notEquals;
|
|
35950
|
-
|
|
35951
|
-
/**
|
|
35952
|
-
* Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
|
|
35953
|
-
* @function
|
|
35954
|
-
* @param {!Long|number|string} other Other value
|
|
35955
|
-
* @returns {boolean}
|
|
35956
|
-
*/
|
|
35957
|
-
LongPrototype.ne = LongPrototype.notEquals;
|
|
35958
|
-
|
|
35959
|
-
/**
|
|
35960
|
-
* Tests if this Long's value is less than the specified's.
|
|
35961
|
-
* @param {!Long|number|string} other Other value
|
|
35962
|
-
* @returns {boolean}
|
|
35963
|
-
*/
|
|
35964
|
-
LongPrototype.lessThan = function lessThan(other) {
|
|
35965
|
-
return this.comp(/* validates */ other) < 0;
|
|
35966
|
-
};
|
|
35967
|
-
|
|
35968
|
-
/**
|
|
35969
|
-
* Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
|
|
35970
|
-
* @function
|
|
35971
|
-
* @param {!Long|number|string} other Other value
|
|
35972
|
-
* @returns {boolean}
|
|
35973
|
-
*/
|
|
35974
|
-
LongPrototype.lt = LongPrototype.lessThan;
|
|
35975
|
-
|
|
35976
|
-
/**
|
|
35977
|
-
* Tests if this Long's value is less than or equal the specified's.
|
|
35978
|
-
* @param {!Long|number|string} other Other value
|
|
35979
|
-
* @returns {boolean}
|
|
35980
|
-
*/
|
|
35981
|
-
LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
|
|
35982
|
-
return this.comp(/* validates */ other) <= 0;
|
|
35983
|
-
};
|
|
35984
|
-
|
|
35985
|
-
/**
|
|
35986
|
-
* Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
|
|
35987
|
-
* @function
|
|
35988
|
-
* @param {!Long|number|string} other Other value
|
|
35989
|
-
* @returns {boolean}
|
|
35990
|
-
*/
|
|
35991
|
-
LongPrototype.lte = LongPrototype.lessThanOrEqual;
|
|
35992
|
-
|
|
35993
|
-
/**
|
|
35994
|
-
* Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
|
|
35995
|
-
* @function
|
|
35996
|
-
* @param {!Long|number|string} other Other value
|
|
35997
|
-
* @returns {boolean}
|
|
35998
|
-
*/
|
|
35999
|
-
LongPrototype.le = LongPrototype.lessThanOrEqual;
|
|
36000
|
-
|
|
36001
|
-
/**
|
|
36002
|
-
* Tests if this Long's value is greater than the specified's.
|
|
36003
|
-
* @param {!Long|number|string} other Other value
|
|
36004
|
-
* @returns {boolean}
|
|
36005
|
-
*/
|
|
36006
|
-
LongPrototype.greaterThan = function greaterThan(other) {
|
|
36007
|
-
return this.comp(/* validates */ other) > 0;
|
|
36008
|
-
};
|
|
36009
|
-
|
|
36010
|
-
/**
|
|
36011
|
-
* Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
|
|
36012
|
-
* @function
|
|
36013
|
-
* @param {!Long|number|string} other Other value
|
|
36014
|
-
* @returns {boolean}
|
|
36015
|
-
*/
|
|
36016
|
-
LongPrototype.gt = LongPrototype.greaterThan;
|
|
36017
|
-
|
|
36018
|
-
/**
|
|
36019
|
-
* Tests if this Long's value is greater than or equal the specified's.
|
|
36020
|
-
* @param {!Long|number|string} other Other value
|
|
36021
|
-
* @returns {boolean}
|
|
36022
|
-
*/
|
|
36023
|
-
LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
|
|
36024
|
-
return this.comp(/* validates */ other) >= 0;
|
|
36025
|
-
};
|
|
36026
|
-
|
|
36027
|
-
/**
|
|
36028
|
-
* Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
|
|
36029
|
-
* @function
|
|
36030
|
-
* @param {!Long|number|string} other Other value
|
|
36031
|
-
* @returns {boolean}
|
|
36032
|
-
*/
|
|
36033
|
-
LongPrototype.gte = LongPrototype.greaterThanOrEqual;
|
|
36034
|
-
|
|
36035
|
-
/**
|
|
36036
|
-
* Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
|
|
36037
|
-
* @function
|
|
36038
|
-
* @param {!Long|number|string} other Other value
|
|
36039
|
-
* @returns {boolean}
|
|
36040
|
-
*/
|
|
36041
|
-
LongPrototype.ge = LongPrototype.greaterThanOrEqual;
|
|
36042
|
-
|
|
36043
|
-
/**
|
|
36044
|
-
* Compares this Long's value with the specified's.
|
|
36045
|
-
* @param {!Long|number|string} other Other value
|
|
36046
|
-
* @returns {number} 0 if they are the same, 1 if the this is greater and -1
|
|
36047
|
-
* if the given one is greater
|
|
36048
|
-
*/
|
|
36049
|
-
LongPrototype.compare = function compare(other) {
|
|
36050
|
-
if (!isLong(other))
|
|
36051
|
-
other = fromValue(other);
|
|
36052
|
-
if (this.eq(other))
|
|
36053
|
-
return 0;
|
|
36054
|
-
var thisNeg = this.isNegative(),
|
|
36055
|
-
otherNeg = other.isNegative();
|
|
36056
|
-
if (thisNeg && !otherNeg)
|
|
36057
|
-
return -1;
|
|
36058
|
-
if (!thisNeg && otherNeg)
|
|
36059
|
-
return 1;
|
|
36060
|
-
// At this point the sign bits are the same
|
|
36061
|
-
if (!this.unsigned)
|
|
36062
|
-
return this.sub(other).isNegative() ? -1 : 1;
|
|
36063
|
-
// Both are positive if at least one is unsigned
|
|
36064
|
-
return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;
|
|
36065
|
-
};
|
|
36066
|
-
|
|
36067
|
-
/**
|
|
36068
|
-
* Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
|
|
36069
|
-
* @function
|
|
36070
|
-
* @param {!Long|number|string} other Other value
|
|
36071
|
-
* @returns {number} 0 if they are the same, 1 if the this is greater and -1
|
|
36072
|
-
* if the given one is greater
|
|
36073
|
-
*/
|
|
36074
|
-
LongPrototype.comp = LongPrototype.compare;
|
|
36075
|
-
|
|
36076
|
-
/**
|
|
36077
|
-
* Negates this Long's value.
|
|
36078
|
-
* @returns {!Long} Negated Long
|
|
36079
|
-
*/
|
|
36080
|
-
LongPrototype.negate = function negate() {
|
|
36081
|
-
if (!this.unsigned && this.eq(MIN_VALUE))
|
|
36082
|
-
return MIN_VALUE;
|
|
36083
|
-
return this.not().add(ONE);
|
|
36084
|
-
};
|
|
36085
|
-
|
|
36086
|
-
/**
|
|
36087
|
-
* Negates this Long's value. This is an alias of {@link Long#negate}.
|
|
36088
|
-
* @function
|
|
36089
|
-
* @returns {!Long} Negated Long
|
|
36090
|
-
*/
|
|
36091
|
-
LongPrototype.neg = LongPrototype.negate;
|
|
36092
|
-
|
|
36093
|
-
/**
|
|
36094
|
-
* Returns the sum of this and the specified Long.
|
|
36095
|
-
* @param {!Long|number|string} addend Addend
|
|
36096
|
-
* @returns {!Long} Sum
|
|
36097
|
-
*/
|
|
36098
|
-
LongPrototype.add = function add(addend) {
|
|
36099
|
-
if (!isLong(addend))
|
|
36100
|
-
addend = fromValue(addend);
|
|
36101
|
-
|
|
36102
|
-
// Divide each number into 4 chunks of 16 bits, and then sum the chunks.
|
|
36103
|
-
|
|
36104
|
-
var a48 = this.high >>> 16;
|
|
36105
|
-
var a32 = this.high & 0xFFFF;
|
|
36106
|
-
var a16 = this.low >>> 16;
|
|
36107
|
-
var a00 = this.low & 0xFFFF;
|
|
36108
|
-
|
|
36109
|
-
var b48 = addend.high >>> 16;
|
|
36110
|
-
var b32 = addend.high & 0xFFFF;
|
|
36111
|
-
var b16 = addend.low >>> 16;
|
|
36112
|
-
var b00 = addend.low & 0xFFFF;
|
|
36113
|
-
|
|
36114
|
-
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
|
|
36115
|
-
c00 += a00 + b00;
|
|
36116
|
-
c16 += c00 >>> 16;
|
|
36117
|
-
c00 &= 0xFFFF;
|
|
36118
|
-
c16 += a16 + b16;
|
|
36119
|
-
c32 += c16 >>> 16;
|
|
36120
|
-
c16 &= 0xFFFF;
|
|
36121
|
-
c32 += a32 + b32;
|
|
36122
|
-
c48 += c32 >>> 16;
|
|
36123
|
-
c32 &= 0xFFFF;
|
|
36124
|
-
c48 += a48 + b48;
|
|
36125
|
-
c48 &= 0xFFFF;
|
|
36126
|
-
return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
|
|
36127
|
-
};
|
|
36128
|
-
|
|
36129
|
-
/**
|
|
36130
|
-
* Returns the difference of this and the specified Long.
|
|
36131
|
-
* @param {!Long|number|string} subtrahend Subtrahend
|
|
36132
|
-
* @returns {!Long} Difference
|
|
36133
|
-
*/
|
|
36134
|
-
LongPrototype.subtract = function subtract(subtrahend) {
|
|
36135
|
-
if (!isLong(subtrahend))
|
|
36136
|
-
subtrahend = fromValue(subtrahend);
|
|
36137
|
-
return this.add(subtrahend.neg());
|
|
36138
|
-
};
|
|
36139
|
-
|
|
36140
|
-
/**
|
|
36141
|
-
* Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
|
|
36142
|
-
* @function
|
|
36143
|
-
* @param {!Long|number|string} subtrahend Subtrahend
|
|
36144
|
-
* @returns {!Long} Difference
|
|
36145
|
-
*/
|
|
36146
|
-
LongPrototype.sub = LongPrototype.subtract;
|
|
36147
|
-
|
|
36148
|
-
/**
|
|
36149
|
-
* Returns the product of this and the specified Long.
|
|
36150
|
-
* @param {!Long|number|string} multiplier Multiplier
|
|
36151
|
-
* @returns {!Long} Product
|
|
36152
|
-
*/
|
|
36153
|
-
LongPrototype.multiply = function multiply(multiplier) {
|
|
36154
|
-
if (this.isZero())
|
|
36155
|
-
return ZERO;
|
|
36156
|
-
if (!isLong(multiplier))
|
|
36157
|
-
multiplier = fromValue(multiplier);
|
|
36158
|
-
|
|
36159
|
-
// use wasm support if present
|
|
36160
|
-
if (wasm) {
|
|
36161
|
-
var low = wasm.mul(this.low,
|
|
36162
|
-
this.high,
|
|
36163
|
-
multiplier.low,
|
|
36164
|
-
multiplier.high);
|
|
36165
|
-
return fromBits(low, wasm.get_high(), this.unsigned);
|
|
36166
|
-
}
|
|
36167
|
-
|
|
36168
|
-
if (multiplier.isZero())
|
|
36169
|
-
return ZERO;
|
|
36170
|
-
if (this.eq(MIN_VALUE))
|
|
36171
|
-
return multiplier.isOdd() ? MIN_VALUE : ZERO;
|
|
36172
|
-
if (multiplier.eq(MIN_VALUE))
|
|
36173
|
-
return this.isOdd() ? MIN_VALUE : ZERO;
|
|
36174
|
-
|
|
36175
|
-
if (this.isNegative()) {
|
|
36176
|
-
if (multiplier.isNegative())
|
|
36177
|
-
return this.neg().mul(multiplier.neg());
|
|
36178
|
-
else
|
|
36179
|
-
return this.neg().mul(multiplier).neg();
|
|
36180
|
-
} else if (multiplier.isNegative())
|
|
36181
|
-
return this.mul(multiplier.neg()).neg();
|
|
36182
|
-
|
|
36183
|
-
// If both longs are small, use float multiplication
|
|
36184
|
-
if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
|
|
36185
|
-
return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
|
|
36186
|
-
|
|
36187
|
-
// Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
|
|
36188
|
-
// We can skip products that would overflow.
|
|
36189
|
-
|
|
36190
|
-
var a48 = this.high >>> 16;
|
|
36191
|
-
var a32 = this.high & 0xFFFF;
|
|
36192
|
-
var a16 = this.low >>> 16;
|
|
36193
|
-
var a00 = this.low & 0xFFFF;
|
|
36194
|
-
|
|
36195
|
-
var b48 = multiplier.high >>> 16;
|
|
36196
|
-
var b32 = multiplier.high & 0xFFFF;
|
|
36197
|
-
var b16 = multiplier.low >>> 16;
|
|
36198
|
-
var b00 = multiplier.low & 0xFFFF;
|
|
36199
|
-
|
|
36200
|
-
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
|
|
36201
|
-
c00 += a00 * b00;
|
|
36202
|
-
c16 += c00 >>> 16;
|
|
36203
|
-
c00 &= 0xFFFF;
|
|
36204
|
-
c16 += a16 * b00;
|
|
36205
|
-
c32 += c16 >>> 16;
|
|
36206
|
-
c16 &= 0xFFFF;
|
|
36207
|
-
c16 += a00 * b16;
|
|
36208
|
-
c32 += c16 >>> 16;
|
|
36209
|
-
c16 &= 0xFFFF;
|
|
36210
|
-
c32 += a32 * b00;
|
|
36211
|
-
c48 += c32 >>> 16;
|
|
36212
|
-
c32 &= 0xFFFF;
|
|
36213
|
-
c32 += a16 * b16;
|
|
36214
|
-
c48 += c32 >>> 16;
|
|
36215
|
-
c32 &= 0xFFFF;
|
|
36216
|
-
c32 += a00 * b32;
|
|
36217
|
-
c48 += c32 >>> 16;
|
|
36218
|
-
c32 &= 0xFFFF;
|
|
36219
|
-
c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
|
|
36220
|
-
c48 &= 0xFFFF;
|
|
36221
|
-
return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
|
|
36222
|
-
};
|
|
36223
|
-
|
|
36224
|
-
/**
|
|
36225
|
-
* Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
|
|
36226
|
-
* @function
|
|
36227
|
-
* @param {!Long|number|string} multiplier Multiplier
|
|
36228
|
-
* @returns {!Long} Product
|
|
36229
|
-
*/
|
|
36230
|
-
LongPrototype.mul = LongPrototype.multiply;
|
|
36231
|
-
|
|
36232
|
-
/**
|
|
36233
|
-
* Returns this Long divided by the specified. The result is signed if this Long is signed or
|
|
36234
|
-
* unsigned if this Long is unsigned.
|
|
36235
|
-
* @param {!Long|number|string} divisor Divisor
|
|
36236
|
-
* @returns {!Long} Quotient
|
|
36237
|
-
*/
|
|
36238
|
-
LongPrototype.divide = function divide(divisor) {
|
|
36239
|
-
if (!isLong(divisor))
|
|
36240
|
-
divisor = fromValue(divisor);
|
|
36241
|
-
if (divisor.isZero())
|
|
36242
|
-
throw Error('division by zero');
|
|
36243
|
-
|
|
36244
|
-
// use wasm support if present
|
|
36245
|
-
if (wasm) {
|
|
36246
|
-
// guard against signed division overflow: the largest
|
|
36247
|
-
// negative number / -1 would be 1 larger than the largest
|
|
36248
|
-
// positive number, due to two's complement.
|
|
36249
|
-
if (!this.unsigned &&
|
|
36250
|
-
this.high === -0x80000000 &&
|
|
36251
|
-
divisor.low === -1 && divisor.high === -1) {
|
|
36252
|
-
// be consistent with non-wasm code path
|
|
36253
|
-
return this;
|
|
36254
|
-
}
|
|
36255
|
-
var low = (this.unsigned ? wasm.div_u : wasm.div_s)(
|
|
36256
|
-
this.low,
|
|
36257
|
-
this.high,
|
|
36258
|
-
divisor.low,
|
|
36259
|
-
divisor.high
|
|
36260
|
-
);
|
|
36261
|
-
return fromBits(low, wasm.get_high(), this.unsigned);
|
|
36262
|
-
}
|
|
36263
|
-
|
|
36264
|
-
if (this.isZero())
|
|
36265
|
-
return this.unsigned ? UZERO : ZERO;
|
|
36266
|
-
var approx, rem, res;
|
|
36267
|
-
if (!this.unsigned) {
|
|
36268
|
-
// This section is only relevant for signed longs and is derived from the
|
|
36269
|
-
// closure library as a whole.
|
|
36270
|
-
if (this.eq(MIN_VALUE)) {
|
|
36271
|
-
if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
|
|
36272
|
-
return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
|
|
36273
|
-
else if (divisor.eq(MIN_VALUE))
|
|
36274
|
-
return ONE;
|
|
36275
|
-
else {
|
|
36276
|
-
// At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
|
|
36277
|
-
var halfThis = this.shr(1);
|
|
36278
|
-
approx = halfThis.div(divisor).shl(1);
|
|
36279
|
-
if (approx.eq(ZERO)) {
|
|
36280
|
-
return divisor.isNegative() ? ONE : NEG_ONE;
|
|
36281
|
-
} else {
|
|
36282
|
-
rem = this.sub(divisor.mul(approx));
|
|
36283
|
-
res = approx.add(rem.div(divisor));
|
|
36284
|
-
return res;
|
|
36285
|
-
}
|
|
36286
|
-
}
|
|
36287
|
-
} else if (divisor.eq(MIN_VALUE))
|
|
36288
|
-
return this.unsigned ? UZERO : ZERO;
|
|
36289
|
-
if (this.isNegative()) {
|
|
36290
|
-
if (divisor.isNegative())
|
|
36291
|
-
return this.neg().div(divisor.neg());
|
|
36292
|
-
return this.neg().div(divisor).neg();
|
|
36293
|
-
} else if (divisor.isNegative())
|
|
36294
|
-
return this.div(divisor.neg()).neg();
|
|
36295
|
-
res = ZERO;
|
|
36296
|
-
} else {
|
|
36297
|
-
// The algorithm below has not been made for unsigned longs. It's therefore
|
|
36298
|
-
// required to take special care of the MSB prior to running it.
|
|
36299
|
-
if (!divisor.unsigned)
|
|
36300
|
-
divisor = divisor.toUnsigned();
|
|
36301
|
-
if (divisor.gt(this))
|
|
36302
|
-
return UZERO;
|
|
36303
|
-
if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true
|
|
36304
|
-
return UONE;
|
|
36305
|
-
res = UZERO;
|
|
36306
|
-
}
|
|
36307
|
-
|
|
36308
|
-
// Repeat the following until the remainder is less than other: find a
|
|
36309
|
-
// floating-point that approximates remainder / other *from below*, add this
|
|
36310
|
-
// into the result, and subtract it from the remainder. It is critical that
|
|
36311
|
-
// the approximate value is less than or equal to the real value so that the
|
|
36312
|
-
// remainder never becomes negative.
|
|
36313
|
-
rem = this;
|
|
36314
|
-
while (rem.gte(divisor)) {
|
|
36315
|
-
// Approximate the result of division. This may be a little greater or
|
|
36316
|
-
// smaller than the actual value.
|
|
36317
|
-
approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
|
|
36318
|
-
|
|
36319
|
-
// We will tweak the approximate result by changing it in the 48-th digit or
|
|
36320
|
-
// the smallest non-fractional digit, whichever is larger.
|
|
36321
|
-
var log2 = Math.ceil(Math.log(approx) / Math.LN2),
|
|
36322
|
-
delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),
|
|
36323
|
-
|
|
36324
|
-
// Decrease the approximation until it is smaller than the remainder. Note
|
|
36325
|
-
// that if it is too large, the product overflows and is negative.
|
|
36326
|
-
approxRes = fromNumber(approx),
|
|
36327
|
-
approxRem = approxRes.mul(divisor);
|
|
36328
|
-
while (approxRem.isNegative() || approxRem.gt(rem)) {
|
|
36329
|
-
approx -= delta;
|
|
36330
|
-
approxRes = fromNumber(approx, this.unsigned);
|
|
36331
|
-
approxRem = approxRes.mul(divisor);
|
|
36332
|
-
}
|
|
36333
|
-
|
|
36334
|
-
// We know the answer can't be zero... and actually, zero would cause
|
|
36335
|
-
// infinite recursion since we would make no progress.
|
|
36336
|
-
if (approxRes.isZero())
|
|
36337
|
-
approxRes = ONE;
|
|
36338
|
-
|
|
36339
|
-
res = res.add(approxRes);
|
|
36340
|
-
rem = rem.sub(approxRem);
|
|
36341
|
-
}
|
|
36342
|
-
return res;
|
|
36343
|
-
};
|
|
36344
|
-
|
|
36345
|
-
/**
|
|
36346
|
-
* Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
|
|
36347
|
-
* @function
|
|
36348
|
-
* @param {!Long|number|string} divisor Divisor
|
|
36349
|
-
* @returns {!Long} Quotient
|
|
36350
|
-
*/
|
|
36351
|
-
LongPrototype.div = LongPrototype.divide;
|
|
36352
|
-
|
|
36353
|
-
/**
|
|
36354
|
-
* Returns this Long modulo the specified.
|
|
36355
|
-
* @param {!Long|number|string} divisor Divisor
|
|
36356
|
-
* @returns {!Long} Remainder
|
|
36357
|
-
*/
|
|
36358
|
-
LongPrototype.modulo = function modulo(divisor) {
|
|
36359
|
-
if (!isLong(divisor))
|
|
36360
|
-
divisor = fromValue(divisor);
|
|
36361
|
-
|
|
36362
|
-
// use wasm support if present
|
|
36363
|
-
if (wasm) {
|
|
36364
|
-
var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(
|
|
36365
|
-
this.low,
|
|
36366
|
-
this.high,
|
|
36367
|
-
divisor.low,
|
|
36368
|
-
divisor.high
|
|
36369
|
-
);
|
|
36370
|
-
return fromBits(low, wasm.get_high(), this.unsigned);
|
|
36371
|
-
}
|
|
36372
|
-
|
|
36373
|
-
return this.sub(this.div(divisor).mul(divisor));
|
|
36374
|
-
};
|
|
36375
|
-
|
|
36376
|
-
/**
|
|
36377
|
-
* Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
|
|
36378
|
-
* @function
|
|
36379
|
-
* @param {!Long|number|string} divisor Divisor
|
|
36380
|
-
* @returns {!Long} Remainder
|
|
36381
|
-
*/
|
|
36382
|
-
LongPrototype.mod = LongPrototype.modulo;
|
|
36383
|
-
|
|
36384
|
-
/**
|
|
36385
|
-
* Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
|
|
36386
|
-
* @function
|
|
36387
|
-
* @param {!Long|number|string} divisor Divisor
|
|
36388
|
-
* @returns {!Long} Remainder
|
|
36389
|
-
*/
|
|
36390
|
-
LongPrototype.rem = LongPrototype.modulo;
|
|
36391
|
-
|
|
36392
|
-
/**
|
|
36393
|
-
* Returns the bitwise NOT of this Long.
|
|
36394
|
-
* @returns {!Long}
|
|
36395
|
-
*/
|
|
36396
|
-
LongPrototype.not = function not() {
|
|
36397
|
-
return fromBits(~this.low, ~this.high, this.unsigned);
|
|
36398
|
-
};
|
|
36399
|
-
|
|
36400
|
-
/**
|
|
36401
|
-
* Returns the bitwise AND of this Long and the specified.
|
|
36402
|
-
* @param {!Long|number|string} other Other Long
|
|
36403
|
-
* @returns {!Long}
|
|
36404
|
-
*/
|
|
36405
|
-
LongPrototype.and = function and(other) {
|
|
36406
|
-
if (!isLong(other))
|
|
36407
|
-
other = fromValue(other);
|
|
36408
|
-
return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
|
|
36409
|
-
};
|
|
36410
|
-
|
|
36411
|
-
/**
|
|
36412
|
-
* Returns the bitwise OR of this Long and the specified.
|
|
36413
|
-
* @param {!Long|number|string} other Other Long
|
|
36414
|
-
* @returns {!Long}
|
|
36415
|
-
*/
|
|
36416
|
-
LongPrototype.or = function or(other) {
|
|
36417
|
-
if (!isLong(other))
|
|
36418
|
-
other = fromValue(other);
|
|
36419
|
-
return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
|
|
36420
|
-
};
|
|
36421
|
-
|
|
36422
|
-
/**
|
|
36423
|
-
* Returns the bitwise XOR of this Long and the given one.
|
|
36424
|
-
* @param {!Long|number|string} other Other Long
|
|
36425
|
-
* @returns {!Long}
|
|
36426
|
-
*/
|
|
36427
|
-
LongPrototype.xor = function xor(other) {
|
|
36428
|
-
if (!isLong(other))
|
|
36429
|
-
other = fromValue(other);
|
|
36430
|
-
return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
|
|
36431
|
-
};
|
|
36432
|
-
|
|
36433
|
-
/**
|
|
36434
|
-
* Returns this Long with bits shifted to the left by the given amount.
|
|
36435
|
-
* @param {number|!Long} numBits Number of bits
|
|
36436
|
-
* @returns {!Long} Shifted Long
|
|
36437
|
-
*/
|
|
36438
|
-
LongPrototype.shiftLeft = function shiftLeft(numBits) {
|
|
36439
|
-
if (isLong(numBits))
|
|
36440
|
-
numBits = numBits.toInt();
|
|
36441
|
-
if ((numBits &= 63) === 0)
|
|
36442
|
-
return this;
|
|
36443
|
-
else if (numBits < 32)
|
|
36444
|
-
return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
|
|
36445
|
-
else
|
|
36446
|
-
return fromBits(0, this.low << (numBits - 32), this.unsigned);
|
|
36447
|
-
};
|
|
36448
|
-
|
|
36449
|
-
/**
|
|
36450
|
-
* Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
|
|
36451
|
-
* @function
|
|
36452
|
-
* @param {number|!Long} numBits Number of bits
|
|
36453
|
-
* @returns {!Long} Shifted Long
|
|
36454
|
-
*/
|
|
36455
|
-
LongPrototype.shl = LongPrototype.shiftLeft;
|
|
36456
|
-
|
|
36457
|
-
/**
|
|
36458
|
-
* Returns this Long with bits arithmetically shifted to the right by the given amount.
|
|
36459
|
-
* @param {number|!Long} numBits Number of bits
|
|
36460
|
-
* @returns {!Long} Shifted Long
|
|
36461
|
-
*/
|
|
36462
|
-
LongPrototype.shiftRight = function shiftRight(numBits) {
|
|
36463
|
-
if (isLong(numBits))
|
|
36464
|
-
numBits = numBits.toInt();
|
|
36465
|
-
if ((numBits &= 63) === 0)
|
|
36466
|
-
return this;
|
|
36467
|
-
else if (numBits < 32)
|
|
36468
|
-
return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
|
|
36469
|
-
else
|
|
36470
|
-
return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
|
|
36471
|
-
};
|
|
36472
|
-
|
|
36473
|
-
/**
|
|
36474
|
-
* Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
|
|
36475
|
-
* @function
|
|
36476
|
-
* @param {number|!Long} numBits Number of bits
|
|
36477
|
-
* @returns {!Long} Shifted Long
|
|
36478
|
-
*/
|
|
36479
|
-
LongPrototype.shr = LongPrototype.shiftRight;
|
|
36480
|
-
|
|
36481
|
-
/**
|
|
36482
|
-
* Returns this Long with bits logically shifted to the right by the given amount.
|
|
36483
|
-
* @param {number|!Long} numBits Number of bits
|
|
36484
|
-
* @returns {!Long} Shifted Long
|
|
36485
|
-
*/
|
|
36486
|
-
LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
|
|
36487
|
-
if (isLong(numBits))
|
|
36488
|
-
numBits = numBits.toInt();
|
|
36489
|
-
numBits &= 63;
|
|
36490
|
-
if (numBits === 0)
|
|
36491
|
-
return this;
|
|
36492
|
-
else {
|
|
36493
|
-
var high = this.high;
|
|
36494
|
-
if (numBits < 32) {
|
|
36495
|
-
var low = this.low;
|
|
36496
|
-
return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);
|
|
36497
|
-
} else if (numBits === 32)
|
|
36498
|
-
return fromBits(high, 0, this.unsigned);
|
|
36499
|
-
else
|
|
36500
|
-
return fromBits(high >>> (numBits - 32), 0, this.unsigned);
|
|
36501
|
-
}
|
|
36502
|
-
};
|
|
36503
|
-
|
|
36504
|
-
/**
|
|
36505
|
-
* Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
|
|
36506
|
-
* @function
|
|
36507
|
-
* @param {number|!Long} numBits Number of bits
|
|
36508
|
-
* @returns {!Long} Shifted Long
|
|
36509
|
-
*/
|
|
36510
|
-
LongPrototype.shru = LongPrototype.shiftRightUnsigned;
|
|
36511
|
-
|
|
36512
|
-
/**
|
|
36513
|
-
* Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
|
|
36514
|
-
* @function
|
|
36515
|
-
* @param {number|!Long} numBits Number of bits
|
|
36516
|
-
* @returns {!Long} Shifted Long
|
|
36517
|
-
*/
|
|
36518
|
-
LongPrototype.shr_u = LongPrototype.shiftRightUnsigned;
|
|
36519
|
-
|
|
36520
|
-
/**
|
|
36521
|
-
* Converts this Long to signed.
|
|
36522
|
-
* @returns {!Long} Signed long
|
|
36523
|
-
*/
|
|
36524
|
-
LongPrototype.toSigned = function toSigned() {
|
|
36525
|
-
if (!this.unsigned)
|
|
36526
|
-
return this;
|
|
36527
|
-
return fromBits(this.low, this.high, false);
|
|
36528
|
-
};
|
|
36529
|
-
|
|
36530
|
-
/**
|
|
36531
|
-
* Converts this Long to unsigned.
|
|
36532
|
-
* @returns {!Long} Unsigned long
|
|
36533
|
-
*/
|
|
36534
|
-
LongPrototype.toUnsigned = function toUnsigned() {
|
|
36535
|
-
if (this.unsigned)
|
|
36536
|
-
return this;
|
|
36537
|
-
return fromBits(this.low, this.high, true);
|
|
36538
|
-
};
|
|
36539
|
-
|
|
36540
|
-
/**
|
|
36541
|
-
* Converts this Long to its byte representation.
|
|
36542
|
-
* @param {boolean=} le Whether little or big endian, defaults to big endian
|
|
36543
|
-
* @returns {!Array.<number>} Byte representation
|
|
36544
|
-
*/
|
|
36545
|
-
LongPrototype.toBytes = function toBytes(le) {
|
|
36546
|
-
return le ? this.toBytesLE() : this.toBytesBE();
|
|
36547
|
-
};
|
|
36548
|
-
|
|
36549
|
-
/**
|
|
36550
|
-
* Converts this Long to its little endian byte representation.
|
|
36551
|
-
* @returns {!Array.<number>} Little endian byte representation
|
|
36552
|
-
*/
|
|
36553
|
-
LongPrototype.toBytesLE = function toBytesLE() {
|
|
36554
|
-
var hi = this.high,
|
|
36555
|
-
lo = this.low;
|
|
36556
|
-
return [
|
|
36557
|
-
lo & 0xff,
|
|
36558
|
-
lo >>> 8 & 0xff,
|
|
36559
|
-
lo >>> 16 & 0xff,
|
|
36560
|
-
lo >>> 24 ,
|
|
36561
|
-
hi & 0xff,
|
|
36562
|
-
hi >>> 8 & 0xff,
|
|
36563
|
-
hi >>> 16 & 0xff,
|
|
36564
|
-
hi >>> 24
|
|
36565
|
-
];
|
|
36566
|
-
};
|
|
36567
|
-
|
|
36568
|
-
/**
|
|
36569
|
-
* Converts this Long to its big endian byte representation.
|
|
36570
|
-
* @returns {!Array.<number>} Big endian byte representation
|
|
36571
|
-
*/
|
|
36572
|
-
LongPrototype.toBytesBE = function toBytesBE() {
|
|
36573
|
-
var hi = this.high,
|
|
36574
|
-
lo = this.low;
|
|
36575
|
-
return [
|
|
36576
|
-
hi >>> 24 ,
|
|
36577
|
-
hi >>> 16 & 0xff,
|
|
36578
|
-
hi >>> 8 & 0xff,
|
|
36579
|
-
hi & 0xff,
|
|
36580
|
-
lo >>> 24 ,
|
|
36581
|
-
lo >>> 16 & 0xff,
|
|
36582
|
-
lo >>> 8 & 0xff,
|
|
36583
|
-
lo & 0xff
|
|
36584
|
-
];
|
|
36585
|
-
};
|
|
36586
|
-
|
|
36587
|
-
/**
|
|
36588
|
-
* Creates a Long from its byte representation.
|
|
36589
|
-
* @param {!Array.<number>} bytes Byte representation
|
|
36590
|
-
* @param {boolean=} unsigned Whether unsigned or not, defaults to signed
|
|
36591
|
-
* @param {boolean=} le Whether little or big endian, defaults to big endian
|
|
36592
|
-
* @returns {Long} The corresponding Long value
|
|
36593
|
-
*/
|
|
36594
|
-
Long.fromBytes = function fromBytes(bytes, unsigned, le) {
|
|
36595
|
-
return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);
|
|
36596
|
-
};
|
|
36597
|
-
|
|
36598
|
-
/**
|
|
36599
|
-
* Creates a Long from its little endian byte representation.
|
|
36600
|
-
* @param {!Array.<number>} bytes Little endian byte representation
|
|
36601
|
-
* @param {boolean=} unsigned Whether unsigned or not, defaults to signed
|
|
36602
|
-
* @returns {Long} The corresponding Long value
|
|
36603
|
-
*/
|
|
36604
|
-
Long.fromBytesLE = function fromBytesLE(bytes, unsigned) {
|
|
36605
|
-
return new Long(
|
|
36606
|
-
bytes[0] |
|
|
36607
|
-
bytes[1] << 8 |
|
|
36608
|
-
bytes[2] << 16 |
|
|
36609
|
-
bytes[3] << 24,
|
|
36610
|
-
bytes[4] |
|
|
36611
|
-
bytes[5] << 8 |
|
|
36612
|
-
bytes[6] << 16 |
|
|
36613
|
-
bytes[7] << 24,
|
|
36614
|
-
unsigned
|
|
36615
|
-
);
|
|
36616
|
-
};
|
|
36617
|
-
|
|
36618
|
-
/**
|
|
36619
|
-
* Creates a Long from its big endian byte representation.
|
|
36620
|
-
* @param {!Array.<number>} bytes Big endian byte representation
|
|
36621
|
-
* @param {boolean=} unsigned Whether unsigned or not, defaults to signed
|
|
36622
|
-
* @returns {Long} The corresponding Long value
|
|
36623
|
-
*/
|
|
36624
|
-
Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
|
|
36625
|
-
return new Long(
|
|
36626
|
-
bytes[4] << 24 |
|
|
36627
|
-
bytes[5] << 16 |
|
|
36628
|
-
bytes[6] << 8 |
|
|
36629
|
-
bytes[7],
|
|
36630
|
-
bytes[0] << 24 |
|
|
36631
|
-
bytes[1] << 16 |
|
|
36632
|
-
bytes[2] << 8 |
|
|
36633
|
-
bytes[3],
|
|
36634
|
-
unsigned
|
|
36635
|
-
);
|
|
36636
|
-
};
|
|
36637
|
-
|
|
36638
35341
|
/**
|
|
36639
35342
|
* Converts a JS date type to a `google.protobuf.Timestamp`. The returned time
|
|
36640
35343
|
* will be represented as UTC.
|
|
@@ -36672,9 +35375,7 @@ function toProtoDuration() {
|
|
|
36672
35375
|
}
|
|
36673
35376
|
function protoToDate(time) {
|
|
36674
35377
|
if (time.seconds != null && time.nanos != null) {
|
|
36675
|
-
var seconds =
|
|
36676
|
-
? time.seconds.toNumber()
|
|
36677
|
-
: time.seconds;
|
|
35378
|
+
var seconds = typeof time.seconds === 'number' ? time.seconds : time.seconds.toNumber();
|
|
36678
35379
|
return new Date(seconds * 1000 + time.nanos / 1000000);
|
|
36679
35380
|
}
|
|
36680
35381
|
}
|
|
@@ -37303,6 +36004,7 @@ function startStream(res, meta) {
|
|
|
37303
36004
|
if (res === void 0) { res = {}; }
|
|
37304
36005
|
var def = {
|
|
37305
36006
|
streamId: { hex: utils.UUID.create() },
|
|
36007
|
+
sceneId: { hex: utils.UUID.create() },
|
|
37306
36008
|
sceneViewId: { hex: utils.UUID.create() },
|
|
37307
36009
|
sessionId: { hex: utils.UUID.create() },
|
|
37308
36010
|
jwt: 'jwt',
|