Lines Matching +full:1 +full:k
34 static Bigint *freelist[Kmax+1];
39 #define PRIVATE_mem ((PRIVATE_MEM+sizeof(double)-1)/sizeof(double))
46 (k) int k; in Balloc() argument
48 (int k)
58 /* The k > Kmax case does not need ACQUIRE_DTOA_LOCK(0), */
60 if (k <= Kmax && (rv = freelist[k]) !=0) {
61 freelist[k] = rv->next;
64 x = 1 << k;
66 rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(ULong));
68 len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1)
70 if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem) {
77 rv->k = k;
94 if (v->k > Kmax)
102 v->next = freelist[v->k];
103 freelist[v->k] = v;
117 int k; local
121 if (x & 1)
124 *y = x >> 1;
125 return 1;
130 k = 0;
132 k = 16;
136 k += 8;
140 k += 4;
144 k += 2;
147 if (!(x & 1)) {
148 k++;
149 x >>= 1;
154 return k;
203 b1 = Balloc(b->k+1);
222 int k = 0; local
225 k = 16;
229 k += 8;
233 k += 4;
237 k += 2;
241 k++;
245 return k;
258 b = Balloc(1);
260 b->wds = 1;
273 int k, wa, wb, wc; local
290 k = a->k;
295 k++;
296 c = Balloc(k);
379 (b, k) Bigint *b; int k; in pow5mult() argument
381 (Bigint *b, int k)
388 if ( (i = k & 3) !=0)
389 b = multadd(b, p05[i-1], 0);
391 if (!(k >>= 2))
396 ACQUIRE_DTOA_LOCK(1);
401 FREE_DTOA_LOCK(1);
408 if (k & 1) {
413 if (!(k >>= 1))
417 ACQUIRE_DTOA_LOCK(1);
422 FREE_DTOA_LOCK(1);
436 (b, k) Bigint *b; int k; in lshift() argument
438 (Bigint *b, int k)
445 n = k >> kshift;
446 k1 = b->k;
447 n1 = n + b->wds + 1;
448 for(i = b->maxwds; n1 > i; i <<= 1)
456 if (k &= kmask) {
458 k1 = 32 - k;
461 *x1++ = *x << k | z;
468 k1 = 16 - k;
471 *x1++ = *x << k & 0xffff | z;
482 b1->wds = n1 - 1;
501 if (i > 1 && !a->x[i-1])
502 Bug("cmp called with a->x[a->wds-1] == 0");
503 if (j > 1 && !b->x[j-1])
504 Bug("cmp called with b->x[b->wds-1] == 0");
514 return *xa < *xb ? -1 : 1;
544 c->wds = 1;
552 i = 1;
556 c = Balloc(a->k);
569 borrow = y >> 32 & 1UL;
575 borrow = y >> 32 & 1UL;
624 int k; local
639 k = hi0bits(y);
640 *e = 32 - k;
642 if (k < Ebits) {
643 d0 = Exp_1 | y >> (Ebits - k);
645 d1 = y << ((32-Ebits) + k) | w >> (Ebits - k);
649 if (k -= Ebits) {
650 d0 = Exp_1 | y << k | z >> (32 - k);
652 d1 = z << k | y >> (32 - k);
659 if (k < Ebits + 16) {
661 d0 = Exp_1 | y << k - Ebits | z >> Ebits + 16 - k;
664 d1 = z << k + 16 - Ebits | w << k - Ebits | y >> 16 + Ebits - k;
669 k -= Ebits + 16;
670 d0 = Exp_1 | y << k + 16 | z << k | w >> 16 - k;
672 d1 = w << k + 16 | y << k;
697 int de, k; local
712 b = Balloc(1);
731 if ( (k = lo0bits(&y)) !=0) {
732 x[0] = y | z << (32 - k);
733 z >>= k;
740 b->wds = (x[1] = z) !=0 ? 2 : 1;
743 k = lo0bits(&z);
748 b->wds = 1;
749 k += 32;
753 if ( (k = lo0bits(&y)) !=0)
754 if (k >= 16) {
755 x[0] = y | z << 32 - k & 0xffff;
756 x[1] = z >> k - 16 & 0xffff;
757 x[2] = z >> k;
762 x[1] = y >> 16 | z << 16 - k & 0xffff;
763 x[2] = z >> k & 0xffff;
764 x[3] = z >> k+16;
769 x[1] = y >> 16;
780 k = lo0bits(&z);
781 if (k >= 16) {
787 x[1] = z >> 16;
788 i = 1;
790 k += 32;
794 b->wds = i + 1;
800 *e = (de - Bias - (P-1) << 2) + k;
801 *bits = 4*P + 8 - k - hi0bits(word0(&d) & Frac_mask);
803 *e = de - Bias - (P-1) + k;
804 *bits = P - k;
809 *e = de - Bias - (P-1) + 1 + k;
811 *bits = 32*i - hi0bits(x[i-1]);
824 bigtens[] = { 1e16, 1e32, 1e64, 1e128, 1e256 };
825 CONST double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128, 1e-256
829 bigtens[] = { 1e16, 1e32, 1e64 };
830 CONST double tinytens[] = { 1e-16, 1e-32, 1e-64 };
832 bigtens[] = { 1e16, 1e32 };
833 CONST double tinytens[] = { 1e-16, 1e-32 };
839 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
840 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
841 1e20, 1e21, 1e22
843 , 1e23, 1e24