;/*FB_PKG_DELIM*/ /** * License: https://www.facebook.com/legal/license/Smm9Lz-9Uuo/ */ __d("Int64",[],(function(t,n,r,o,a,i){Int64=function(e,t){this.low_=e,this.high_=t},Int64.IntCache_={},Int64.fromInt=function(e){if(-128<=e&&e<128){var t=Int64.IntCache_[e];if(t)return t}var n=new Int64(e|0,e<0?-1:0);return-128<=e&&e<128&&(Int64.IntCache_[e]=n),n},Int64.fromNumber=function(e){return isNaN(e)||!isFinite(e)?Int64.ZERO:e<=-Int64.TWO_PWR_63_DBL_?Int64.MIN_VALUE:e+1>=Int64.TWO_PWR_63_DBL_?Int64.MAX_VALUE:e<0?Int64.fromNumber(-e).negate():new Int64(e%Int64.TWO_PWR_32_DBL_|0,e/Int64.TWO_PWR_32_DBL_|0)},Int64.fromBits=function(e,t){return new Int64(e,t)},Int64.fromString=function(e,t){if(e.length==0)throw Error("number format error: empty string");var n=t||10;if(n<2||36=0)throw Error('number format error: interior "-" character: '+e);for(var r=Int64.fromNumber(Math.pow(n,8)),o=Int64.ZERO,a=0;a>t&1,t-=1;t=31;for(var n=0;n<32;n++)e[n]=this.high_>>t&1,t-=1;return e.join("")},Int64.prototype.toString=function(e){var t=e||10;if(t<2||36=0?this.low_:Int64.TWO_PWR_32_DBL_+this.low_},Int64.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(Int64.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var e=this.high_!=0?this.high_:this.low_,t=31;t>0&&(e&1<0},Int64.prototype.greaterThanOrEqual=function(e){return this.compare(e)>=0},Int64.prototype.compare=function(e){if(this.equals(e))return 0;var t=this.isNegative(),n=e.isNegative();return t&&!n?-1:!t&&n?1:this.subtract(e).isNegative()?-1:1},Int64.prototype.negate=function(){return this.equals(Int64.MIN_VALUE)?Int64.MIN_VALUE:this.not().add(Int64.ONE)},Int64.prototype.add=function(e){var t=this.high_>>>16,n=this.high_&65535,r=this.low_>>>16,o=this.low_&65535,a=e.high_>>>16,i=e.high_&65535,l=e.low_>>>16,s=e.low_&65535,u=0,c=0,d=0,m=0;return m+=o+s,d+=m>>>16,m&=65535,d+=r+l,c+=d>>>16,d&=65535,c+=n+i,u+=c>>>16,c&=65535,u+=t+a,u&=65535,Int64.fromBits(d<<16|m,u<<16|c)},Int64.prototype.subtract=function(e){return this.add(e.negate())},Int64.prototype.multiply=function(e){if(this.isZero())return Int64.ZERO;if(e.isZero())return Int64.ZERO;if(this.equals(Int64.MIN_VALUE))return e.isOdd()?Int64.MIN_VALUE:Int64.ZERO;if(e.equals(Int64.MIN_VALUE))return this.isOdd()?Int64.MIN_VALUE:Int64.ZERO;if(this.isNegative())return e.isNegative()?this.negate().multiply(e.negate()):this.negate().multiply(e).negate();if(e.isNegative())return this.multiply(e.negate()).negate();if(this.lessThan(Int64.TWO_PWR_24_)&&e.lessThan(Int64.TWO_PWR_24_))return Int64.fromNumber(this.toNumber()*e.toNumber());var t=this.high_>>>16,n=this.high_&65535,r=this.low_>>>16,o=this.low_&65535,a=e.high_>>>16,i=e.high_&65535,l=e.low_>>>16,s=e.low_&65535,u=0,c=0,d=0,m=0;return m+=o*s,d+=m>>>16,m&=65535,d+=r*s,c+=d>>>16,d&=65535,d+=o*l,c+=d>>>16,d&=65535,c+=n*s,u+=c>>>16,c&=65535,c+=r*l,u+=c>>>16,c&=65535,c+=o*i,u+=c>>>16,c&=65535,u+=t*s+n*l+r*i+o*a,u&=65535,Int64.fromBits(d<<16|m,u<<16|c)},Int64.prototype.div=function(e){if(e.isZero())throw Error("division by zero");if(this.isZero())return Int64.ZERO;if(this.equals(Int64.MIN_VALUE)){if(e.equals(Int64.ONE)||e.equals(Int64.NEG_ONE))return Int64.MIN_VALUE;if(e.equals(Int64.MIN_VALUE))return Int64.ONE;var t=this.shiftRight(1),n=t.div(e).shiftLeft(1);if(n.equals(Int64.ZERO))return e.isNegative()?Int64.ONE:Int64.NEG_ONE;var a=this.subtract(e.multiply(n)),r=n.add(a.div(e));return r}else if(e.equals(Int64.MIN_VALUE))return Int64.ZERO;if(this.isNegative())return e.isNegative()?this.negate().div(e.negate()):this.negate().div(e).negate();if(e.isNegative())return this.div(e.negate()).negate();for(var o=Int64.ZERO,a=this;a.greaterThanOrEqual(e);){for(var n=Math.max(1,Math.floor(a.toNumber()/e.toNumber())),i=Math.ceil(Math.log(n)/Math.LN2),l=i<=48?1:Math.pow(2,i-48),s=Int64.fromNumber(n),u=s.multiply(e);u.isNegative()||u.greaterThan(a);)n-=l,s=Int64.fromNumber(n),u=s.multiply(e);s.isZero()&&(s=Int64.ONE),o=o.add(s),a=a.subtract(u)}return o},Int64.prototype.modulo=function(e){return this.subtract(this.div(e).multiply(e))},Int64.prototype.not=function(){return Int64.fromBits(~this.low_,~this.high_)},Int64.prototype.and=function(e){return Int64.fromBits(this.low_&e.low_,this.high_&e.high_)},Int64.prototype.or=function(e){return Int64.fromBits(this.low_|e.low_,this.high_|e.high_)},Int64.prototype.xor=function(e){return Int64.fromBits(this.low_^e.low_,this.high_^e.high_)},Int64.prototype.shiftLeft=function(e){if(e&=63,e==0)return this;var t=this.low_;if(e<32){var n=this.high_;return Int64.fromBits(t<>>32-e)}else return Int64.fromBits(0,t<>>e|t<<32-e,t>>e)}else return Int64.fromBits(t>>e-32,t>=0?0:-1)},Int64.prototype.shiftRightUnsigned=function(e){if(e&=63,e==0)return this;var t=this.high_;if(e<32){var n=this.low_;return Int64.fromBits(n>>>e|t<<32-e,t>>>e)}else return e==32?Int64.fromBits(t,0):Int64.fromBits(t>>>e-32,0)},a.exports=Int64}),null);