@vertexvis/stream-api 0.15.1-canary.2 → 0.15.1-canary.3

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