(function(){ MAX_UINT=4294967295; MAX_SINT=2147483647; function trunc(f){ if(f>0){ return Math.floor(f); }else{ return Math.ceil(f); } } function norm(_2,_3){ if(_2.v[0]>MAX_UINT){ var _4=trunc(_2.v[0]/(MAX_UINT+1)); _2.v[0]-=_4*(MAX_UINT+1); _2.v[1]+=_4; } while(_2.v[0]<0){ var _4=trunc(-_2.v[0]/(MAX_UINT+1))+1; _2.v[0]+=_4*(MAX_UINT+1); _2.v[1]-=_4; } if(_3){ return; } while(_2.v[1]>MAX_SINT){ _2.v[1]-=MAX_SINT+1; } while(_2.v[1]<-MAX_SINT-1){ _2.v[1]+=MAX_SINT+1; } } function add(_5,m,_7){ if(typeof m=="object"){ for(var i=1;i>=0;--i){ _5.v[i]+=m.v[i]; } }else{ _5.v[0]+=m; } norm(_5,_7); } function sub(_9,m){ if(typeof m=="object"){ for(var i=1;i>=0;--i){ _9.v[i]-=m.v[i]; } }else{ _9.v[0]-=m; } norm(_9); } function mul16(_c,m){ for(var i=1;i>=0;--i){ _c.v[i]*=m; } norm(_c); } function mul(_f,m,_11){ var mHi=trunc(m/65536); var mLo=m-mHi*65536; var xHi=_f.v[1]; var xLo=_f.v[0]; var t0=xHi*mHi; var t1=xHi*mLo; var t2=xLo*mHi; var t3=xLo*mLo; _f.v[1]=(t0*65536)+t1; _f.v[0]=(t2*65536)+t3; norm(_f,_11); } function neg(obj,_1b){ obj.v[0]=-obj.v[0]; obj.v[1]=-obj.v[1]; norm(obj,_1b); } var _1c=[]; _1c[0]=1; for(var i=1;i<=9;++i){ _1c[i]=10*_1c[i-1]; } Int64=function(lo,hi){ this.v=[]; this.v[0]=0; this.v[1]=0; switch(typeof lo){ case "string": var str=lo; var len=str.length; var n=9; var i=0; var _24=1; if(str.charAt(0)=="-"){ _24=-1; str=str.substr(1,--len); } n=len%9; if(n==0){ n=9; } while(1){ if(i+n>len){ n=len-i; } var t=parseInt(str.substring(i,i+n),10); if(i>0){ mul(this,_1c[n],true); } add(this,t,true); i+=n; if(i>=len){ break; } n=9; } if(_24<0){ neg(this); } break; case "object": this.v[0]=lo.v[0]; this.v[1]=lo.v[1]; break; case "number": if(lo){ this.v[0]=lo; } if(hi){ this.v[1]=hi; } norm(this); break; case "null": case "undefined": break; default: throw Error("Int64: Illegal initializer passed to constructor"); } }; Int64.prototype.neg=function(v){ neg(this); }; Int64.prototype.add=function(v){ add(this,v); }; Int64.prototype.sub=function(v){ sub(this,v); }; Int64.prototype.mul=function(m){ mul(this,m); }; Int64.prototype.get54bitValue=function(){ if(this.v[1]>4194303||this.v[1]<-4194303){ throw Error("Int64: value doesn't fit in 54 bits!"); } return this.v[1]*4294967296+this.v[0]; }; Int64.prototype.cmp=function(val){ if(this.v[1]>val.v[1]){ return 1; }else{ if(this.v[1]val.v[0]){ return 1; }else{ if(this.v[0]