1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | 1× 1× 102× 102× 102× 102× 102× 102× 102× 1× 3× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 50× 1× 1× 50× 50× 50× 1500× 50× 1× 1× 1× 1× 202× 202× 202× 1× 1× | "use strict"; var OverflowInt = (function () { function OverflowInt(_value, MIN_SAFE_VALUE, MAX_SAFE_VALUE) { Iif (_value === void 0) { _value = 0; } if (MIN_SAFE_VALUE === void 0) { MIN_SAFE_VALUE = -2147483648; } if (MAX_SAFE_VALUE === void 0) { MAX_SAFE_VALUE = 2147483647; } this._value = _value; this.MIN_SAFE_VALUE = MIN_SAFE_VALUE; this.MAX_SAFE_VALUE = MAX_SAFE_VALUE; this._value = this.valCheck(this._value) | 0; } Object.defineProperty(OverflowInt.prototype, "value", { get: function () { return this._value; }, enumerable: true, configurable: true }); OverflowInt.prototype.valueOf = function () { return this._value; }; Object.defineProperty(OverflowInt.prototype, "minValue", { get: function () { if (this._minValue === undefined) { this._minValue = new OverflowInt(this.MIN_SAFE_VALUE, this.MIN_SAFE_VALUE, this.MAX_SAFE_VALUE); } return this._minValue; }, enumerable: true, configurable: true }); Object.defineProperty(OverflowInt.prototype, "maxValue", { get: function () { if (this._maxValue) { this._maxValue = new OverflowInt(this.MAX_SAFE_VALUE, this.MIN_SAFE_VALUE, this.MAX_SAFE_VALUE); } return this._maxValue; }, enumerable: true, configurable: true }); Object.defineProperty(OverflowInt.prototype, "byteLength", { get: function () { return 32; }, enumerable: true, configurable: true }); Object.defineProperty(OverflowInt.prototype, "isSigned", { get: function () { return true; }, enumerable: true, configurable: true }); Object.defineProperty(OverflowInt.prototype, "isNegative", { get: function () { return this._value < 0; }, enumerable: true, configurable: true }); OverflowInt.prototype.equals = function (v) { return this._value === v.valueOf(); }; OverflowInt.prototype.lessThan = function (v) { return this._value < v.valueOf(); }; OverflowInt.prototype.greaterThan = function (v) { return this._value > v.valueOf(); }; OverflowInt.prototype.negate = function () { return new OverflowInt(this._value * -1, this.MIN_SAFE_VALUE, this.MAX_SAFE_VALUE); }; OverflowInt.prototype.plus = function (v) { return new OverflowInt(this._value + this.valCheck(v), this.MIN_SAFE_VALUE, this.MAX_SAFE_VALUE); }; OverflowInt.prototype.minus = function (v) { return this.plus(v * -1); }; OverflowInt.prototype.times = function (v) { v = this.valCheck(v); var v2 = this._value; for (var i = 1; i < v; i++) { v2 = (this._value + v2) | 0; } return new OverflowInt(v2, this.MIN_SAFE_VALUE, this.MAX_SAFE_VALUE); }; OverflowInt.prototype.divide = function (v) { return new OverflowInt(this._value / this.valCheck(v), this.MIN_SAFE_VALUE, this.MAX_SAFE_VALUE); }; OverflowInt.prototype.toString = function () { return String(this.value); }; OverflowInt.prototype.toJSON = function () { return this.value; }; OverflowInt.prototype.valCheck = function (v) { Iif (v > this.MAX_SAFE_VALUE) throw new RangeError("The given integer is greater than the MAX_SAFE_VALUE."); Iif (v < this.MIN_SAFE_VALUE) throw new RangeError("The given integer is less than the MIN_SAFE_VALUE."); return v | 0; }; return OverflowInt; }()); exports.OverflowInt = OverflowInt; //# sourceMappingURL=OverflowInt.js.map |