Lines Matching defs:this
19 if("number" == typeof a) this.fromNumber(a,b,c);
20 else if(b == null && "string" != typeof a) this.fromString(a,256);
21 else this.fromString(a,b);
30 // We need to select the fastest one that works in this environment.
37 var v = x*this[i++]+w[j]+c;
49 var l = this[i]&0x7fff;
50 var h = this[i++]>>15;
63 var l = this[i]&0x3fff;
64 var h = this[i++]>>14;
112 // (protected) copy this to r
114 for(var i = this.t-1; i >= 0; --i) r[i] = this[i];
115 r.t = this.t;
116 r.s = this.s;
121 this.t = 1;
122 this.s = (x<0)?-1:0;
123 if(x > 0) this[0] = x;
124 else if(x < -1) this[0] = x+this.DV;
125 else this.t = 0;
140 else { this.fromRadix(s,b); return; }
141 this.t = 0;
142 this.s = 0;
152 this[this.t++] = x;
153 else if(sh+k > this.DB) {
154 this[this.t-1] |= (x&((1<<(this.DB-sh))-1))<<sh;
155 this[this.t++] = (x>>(this.DB-sh));
158 this[this.t-1] |= x<<sh;
160 if(sh >= this.DB) sh -= this.DB;
163 this.s = -1;
164 if(sh > 0) this[this.t-1] |= ((1<<(this.DB-sh))-1)<<sh;
166 this.clamp();
167 if(mi) BigInteger.ZERO.subTo(this,this);
172 var c = this.s&this.DM;
173 while(this.t > 0 && this[this.t-1] == c) --this.t;
178 if(this.s < 0) return "-"+this.negate().toString(b);
185 else return this.toRadix(b);
186 var km = (1<<k)-1, d, m = false, r = "", i = this.t;
187 var p = this.DB-(i*this.DB)%k;
189 if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }
192 d = (this[i]&((1<<p)-1))<<(k-p);
193 d |= this[--i]>>(p+=this.DB-k);
196 d = (this[i]>>(p-=k))&km;
197 if(p <= 0) { p += this.DB; --i; }
206 // (public) -this
207 function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; }
209 // (public) |this|
210 function bnAbs() { return (this.s<0)?this.negate():this; }
212 // (public) return + if this > a, - if this < a, 0 if equal
214 var r = this.s-a.s;
216 var i = this.t;
218 if(r != 0) return (this.s<0)?-r:r;
219 while(--i >= 0) if((r=this[i]-a[i]) != 0) return r;
234 // (public) return the number of bits in "this"
236 if(this.t <= 0) return 0;
237 return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM));
240 // (protected) r = this << n*DB
243 for(i = this.t-1; i >= 0; --i) r[i+n] = this[i];
245 r.t = this.t+n;
246 r.s = this.s;
249 // (protected) r = this >> n*DB
251 for(var i = n; i < this.t; ++i) r[i-n] = this[i];
252 r.t = Math.max(this.t-n,0);
253 r.s = this.s;
256 // (protected) r = this << n
258 var bs = n%this.DB;
259 var cbs = this.DB-bs;
261 var ds = Math.floor(n/this.DB), c = (this.s<<bs)&this.DM, i;
262 for(i = this.t-1; i >= 0; --i) {
263 r[i+ds+1] = (this[i]>>cbs)|c;
264 c = (this[i]&bm)<<bs;
268 r.t = this.t+ds+1;
269 r.s = this.s;
273 // (protected) r = this >> n
275 r.s = this.s;
276 var ds = Math.floor(n/this.DB);
277 if(ds >= this.t) { r.t = 0; return; }
278 var bs = n%this.DB;
279 var cbs = this.DB-bs;
281 r[0] = this[ds]>>bs;
282 for(var i = ds+1; i < this.t; ++i) {
283 r[i-ds-1] |= (this[i]&bm)<<cbs;
284 r[i-ds] = this[i]>>bs;
286 if(bs > 0) r[this.t-ds-1] |= (this.s&bm)<<cbs;
287 r.t = this.t-ds;
291 // (protected) r = this - a
293 var i = 0, c = 0, m = Math.min(a.t,this.t);
295 c += this[i]-a[i];
296 r[i++] = c&this.DM;
297 c >>= this.DB;
299 if(a.t < this.t) {
301 while(i < this.t) {
302 c += this[i];
303 r[i++] = c&this.DM;
304 c >>= this.DB;
306 c += this.s;
309 c += this.s;
312 r[i++] = c&this.DM;
313 c >>= this.DB;
318 if(c < -1) r[i++] = this.DV+c;
324 // (protected) r = this * a, r != this,a (HAC 14.12)
325 // "this" should be the larger one if appropriate.
327 var x = this.abs(), y = a.abs();
334 if(this.s != a.s) BigInteger.ZERO.subTo(r,r);
337 // (protected) r = this^2, r != this (HAC 14.16)
339 var x = this.abs();
354 // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)
355 // r != q, this != m. q or r may be null.
359 var pt = this.abs();
362 if(r != null) this.copyTo(r);
366 var y = nbi(), ts = this.s, ms = m.s;
367 var nsh = this.DB-nbits(pm[pm.t-1]); // normalize modulus
373 var yt = y0*(1<<this.F1)+((ys>1)?y[ys-2]>>this.F2:0);
374 var d1 = this.FV/yt, d2 = (1<<this.F1)/yt, e = 1<<this.F2;
386 var qd = (r[--i]==y0)?this.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2);
403 // (public) this mod a
406 this.abs().divRemTo(a,null,r);
407 if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r);
412 function Classic(m) { this.m = m; }
414 if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);
418 function cReduce(x) { x.divRemTo(this.m,null,x); }
419 function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
420 function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
428 // (protected) return "-1/this % 2^DB"; useful for Mont. reduction
439 if(this.t < 1) return 0;
440 var x = this[0];
448 y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits
450 return (y>0)?this.DV-y:-y;
455 this.m = m;
456 this.mp = m.invDigit();
457 this.mpl = this.mp&0x7fff;
458 this.mph = this.mp>>15;
459 this.um = (1<<(m.DB-15))-1;
460 this.mt2 = 2*m.t;
466 x.abs().dlShiftTo(this.m.t,r);
467 r.divRemTo(this.m,null,r);
468 if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r);
476 this.reduce(r);
482 while(x.t <= this.mt2) // pad x so am has enough room later
484 for(var i = 0; i < this.m.t; ++i) {
487 var u0 = (j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM;
489 j = i+this.m.t;
490 x[j] += this.m.am(0,u0,x,i,0,this.m.t);
495 x.drShiftTo(this.m.t,x);
496 if(x.compareTo(this.m) >= 0) x.subTo(this.m,x);
500 function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
503 function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
511 // (protected) true iff this is even
512 function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; }
514 // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
517 var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1;
527 // (public) this^e % m, 0 <= e < 2^32
531 return this.exp(e,z);
574 function bnClone() { var r = nbi(); this.copyTo(r); return r; }
578 if(this.s < 0) {
579 if(this.t == 1) return this[0]-this.DV;
580 else if(this.t == 0) return -1;
582 else if(this.t == 1) return this[0];
583 else if(this.t == 0) return 0;
585 return ((this[1]&((1<<(32-this.DB))-1))<<this.DB)|this[0];
589 function bnByteValue() { return (this.t==0)?this.s:(this[0]<<24)>>24; }
592 function bnShortValue() { return (this.t==0)?this.s:(this[0]<<16)>>16; }
595 function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); }
597 // (public) 0 if this == 0, 1 if this > 0
599 if(this.s < 0) return -1;
600 else if(this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0;
607 if(this.signum() == 0 || b < 2 || b > 36) return "0";
608 var cs = this.chunkSize(b);
611 this.divRemTo(d,y,z);
621 this.fromInt(0);
623 var cs = this.chunkSize(b);
628 if(s.charAt(i) == "-" && this.signum() == 0) mi = true;
633 this.dMultiply(d);
634 this.dAddOffset(w,0);
640 this.dMultiply(Math.pow(b,j));
641 this.dAddOffset(w,0);
643 if(mi) BigInteger.ZERO.subTo(this,this);
650 if(a < 2) this.fromInt(1);
652 this.fromNumber(a,c);
653 if(!this.testBit(a-1)) // force MSB set
654 this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this);
655 if(this.isEven()) this.dAddOffset(1,0); // force odd
656 while(!this.isProbablePrime(b)) {
657 this.dAddOffset(2,0);
658 if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this);
668 this.fromString(x,256);
674 var i = this.t, r = new Array();
675 r[0] = this.s;
676 var p = this.DB-(i*this.DB)%8, d, k = 0;
678 if(p < this.DB && (d = this[i]>>p) != (this.s&this.DM)>>p)
679 r[k++] = d|(this.s<<(this.DB-p));
682 d = (this[i]&((1<<p)-1))<<(8-p);
683 d |= this[--i]>>(p+=this.DB-8);
686 d = (this[i]>>(p-=8))&0xff;
687 if(p <= 0) { p += this.DB; --i; }
690 if(k == 0 && (this.s&0x80) != (d&0x80)) ++k;
691 if(k > 0 || d != this.s) r[k++] = d;
697 function bnEquals(a) { return(this.compareTo(a)==0); }
698 function bnMin(a) { return(this.compareTo(a)<0)?this:a; }
699 function bnMax(a) { return(this.compareTo(a)>0)?this:a; }
701 // (protected) r = this op a (bitwise)
703 var i, f, m = Math.min(a.t,this.t);
704 for(i = 0; i < m; ++i) r[i] = op(this[i],a[i]);
705 if(a.t < this.t) {
706 f = a.s&this.DM;
707 for(i = m; i < this.t; ++i) r[i] = op(this[i],f);
708 r.t = this.t;
711 f = this.s&this.DM;
715 r.s = op(this.s,a.s);
719 // (public) this & a
721 function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; }
723 // (public) this | a
725 function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; }
727 // (public) this ^ a
729 function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; }
731 // (public) this & ~a
733 function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; }
735 // (public) ~this
738 for(var i = 0; i < this.t; ++i) r[i] = this.DM&~this[i];
739 r.t = this.t;
740 r.s = ~this.s;
744 // (public) this << n
747 if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r);
751 // (public) this >> n
754 if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r);
772 for(var i = 0; i < this.t; ++i)
773 if(this[i] != 0) return i*this.DB+lbit(this[i]);
774 if(this.s < 0) return this.t*this.DB;
787 var r = 0, x = this.s&this.DM;
788 for(var i = 0; i < this.t; ++i) r += cbit(this[i]^x);
794 var j = Math.floor(n/this.DB);
795 if(j >= this.t) return(this.s!=0);
796 return((this[j]&(1<<(n%this.DB)))!=0);
799 // (protected) this op (1<<n)
802 this.bitwiseTo(r,op,r);
806 // (public) this | (1<<n)
807 function bnSetBit(n) { return this.changeBit(n,op_or); }
809 // (public) this & ~(1<<n)
810 function bnClearBit(n) { return this.changeBit(n,op_andnot); }
812 // (public) this ^ (1<<n)
813 function bnFlipBit(n) { return this.changeBit(n,op_xor); }
815 // (protected) r = this + a
817 var i = 0, c = 0, m = Math.min(a.t,this.t);
819 c += this[i]+a[i];
820 r[i++] = c&this.DM;
821 c >>= this.DB;
823 if(a.t < this.t) {
825 while(i < this.t) {
826 c += this[i];
827 r[i++] = c&this.DM;
828 c >>= this.DB;
830 c += this.s;
833 c += this.s;
836 r[i++] = c&this.DM;
837 c >>= this.DB;
843 else if(c < -1) r[i++] = this.DV+c;
848 // (public) this + a
849 function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; }
851 // (public) this - a
852 function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; }
854 // (public) this * a
855 function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; }
857 // (public) this^2
858 function bnSquare() { var r = nbi(); this.squareTo(r); return r; }
860 // (public) this / a
861 function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }
863 // (public) this % a
864 function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; }
866 // (public) [this/a,this%a]
869 this.divRemTo(a,q,r);
873 // (protected) this *= n, this >= 0, 1 < n < DV
875 this[this.t] = this.am(0,n-1,this,0,0,this.t);
876 ++this.t;
877 this.clamp();
880 // (protected) this += n << w words, this >= 0
883 while(this.t <= w) this[this.t++] = 0;
884 this[w] += n;
885 while(this[w] >= this.DV) {
886 this[w] -= this.DV;
887 if(++w >= this.t) this[this.t++] = 0;
888 ++this[w];
903 // (public) this^e
904 function bnPow(e) { return this.exp(e,new NullExp()); }
906 // (protected) r = lower n words of "this * a", a.t <= n
907 // "this" should be the larger one if appropriate.
909 var i = Math.min(this.t+a.t,n);
910 r.s = 0; // assumes a,this >= 0
914 for(j = r.t-this.t; i < j; ++i) r[i+this.t] = this.am(0,a[i],r,i,0,this.t);
915 for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a[i],r,i,0,n-i);
919 // (protected) r = "this * a" without lower n words, n > 0
920 // "this" should be the larger one if appropriate.
923 var i = r.t = this.t+a.t-n;
924 r.s = 0; // assumes a,this >= 0
926 for(i = Math.max(n-this.t,0); i < a.t; ++i)
927 r[this.t+i-n] = this.am(n-i,a[i],r,0,0,this.t+i-n);
935 this.r2 = nbi();
936 this.q3 = nbi();
937 BigInteger.ONE.dlShiftTo(2*m.t,this.r2);
938 this.mu = this.r2.divide(m);
939 this.m = m;
943 if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m);
944 else if(x.compareTo(this.m) < 0) return x;
945 else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; }
952 x.drShiftTo(this.m.t-1,this.r2);
953 if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); }
954 this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);
955 this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);
956 while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1);
957 x.subTo(this.r2,x);
958 while(x.compareTo(this.m) >= 0) x.subTo(this.m,x);
962 function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
965 function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
973 // (public) this^e % m (HAC 14.85)
991 g[1] = z.convert(this);
1008 if(j > 0) w |= e[j-1]>>(this.DB+i-k1);
1013 if((i -= n) < 0) { i += this.DB; --j; }
1026 if(--i < 0) { i = this.DB-1; --j; }
1032 // (public) gcd(this,a) (HAC 14.54)
1034 var x = (this.s<0)?this.negate():this.clone();
1060 // (protected) this % n, n < 2^26
1063 var d = this.DV%n, r = (this.s<0)?n-1:0;
1064 if(this.t > 0)
1065 if(d == 0) r = this[0]%n;
1066 else for(var i = this.t-1; i >= 0; --i) r = (d*r+this[i])%n;
1070 // (public) 1/this % m (HAC 14.61)
1073 if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO;
1074 var u = m.clone(), v = this.clone();
1080 if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); }
1089 if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); }
1117 var i, x = this.abs();
1136 var n1 = this.subtract(BigInteger.ONE);
1146 var y = a.modPow(r,this);
1150 y = y.modPowInt(2,this);
1305 this.i = 0;
1306 this.j = 0;
1307 this.S = new Array();
1314 this.S[i] = i;
1317 j = (j + this.S[i] + key[i % key.length]) & 255;
1318 t = this.S[i];
1319 this.S[i] = this.S[j];
1320 this.S[j] = t;
1322 this.i = 0;
1323 this.j = 0;
1328 this.i = (this.i + 1) & 255;
1329 this.j = (this.j + this.S[this.i]) & 255;
1330 t = this.S[this.i];
1331 this.S[this.i] = this.S[this.j];
1332 this.S[this.j] = t;
1333 return this.S[(t + this.S[this.i]) & 255];
1355 this.jsbn = {
1361 }).call(this);