Lines Matching refs:BNS

45 static INLINE BNS mpi_logic(BNS op1, BNS op2, BNS op);
46 static void mpi_log(mpi *rop, mpi *op1, mpi *op2, BNS op);
54 static BNS onedig[1] = { 1 };
55 static mpi mpone = { 1, 1, 0, (BNS*)&onedig };
65 op->digs = mp_malloc(sizeof(BNS));
82 rop->digs = mp_realloc(rop->digs, sizeof(BNS) * op->size);
86 memcpy(rop->digs, op->digs, sizeof(BNS) * op->size);
114 rop->digs = mp_realloc(rop->digs, sizeof(BNS) * size);
120 rop->digs[0] = (BNS)ui;
122 rop->digs[1] = (BNS)(ui >> BNSBITS);
151 rop->digs[0] = (BNS)ui;
153 rop->digs[1] = (BNS)(ui >> BNSBITS);
190 rop->digs = mp_realloc(rop->digs, sizeof(BNS) * size);
202 rop->digs[i] = (BNS)mantissa;
215 /* how many BNS in the given base, log(base) / log(CARRY) */
304 rop->digs = mp_realloc(rop->digs, size * sizeof(BNS));
310 memset(rop->digs, '\0', size * sizeof(BNS));
323 rop->digs[0] = (BNS)value;
327 rop->digs[i] = (BNS)value;
345 BNS digs[2];
348 op.digs = (BNS*)digs;
363 BNS digs[2];
366 op.digs = (BNS*)digs;
381 rop->digs = mp_realloc(rop->digs, sizeof(BNS) * xlen);
400 rop->digs = mp_realloc(rop->digs, sizeof(BNS) * xlen);
421 BNS *digs; /* result data */
437 rop->digs = mp_realloc(rop->digs, sizeof(BNS) * op2->size);
441 memmove(rop->digs, op2->digs, sizeof(BNS) * op2->size);
456 rop->digs = mp_realloc(rop->digs, sizeof(BNS) * op1->size);
460 memmove(rop->digs, op1->digs, sizeof(BNS) * op1->size);
471 digs = mp_calloc(1, sizeof(BNS) * xsize);
474 rop->digs = mp_realloc(rop->digs, sizeof(BNS) * xsize);
478 memset(digs, '\0', sizeof(BNS) * xsize);
499 BNS digs[2];
502 op.digs = (BNS*)digs;
532 BNS qest; /* estimative of quotient value */
533 BNS *qdigs, *rdigs; /* work copy or result */
534 BNS *ndigs, *ddigs; /* work copy or divisor and dividend */
537 BNS carry, scarry, denorm; /* carry and normalization */
549 rrop->digs = mp_realloc(rrop->digs, sizeof(BNS) * num->size);
553 memcpy(rrop->digs, num->digs, sizeof(BNS) * num->size);
572 qdigs = mp_calloc(1, sizeof(BNS) * qsize);
575 qrop->digs = mp_realloc(qrop->digs, sizeof(BNS) * qsize);
578 memset(qrop->digs, '\0', sizeof(BNS) * qsize);
583 rdigs = mp_calloc(1, sizeof(BNS) * rsize);
586 rrop->digs = mp_realloc(rrop->digs, sizeof(BNS) * rsize);
589 memset(rrop->digs, '\0', sizeof(BNS) * rsize);
600 qdigs[i] = (BNS)(value / den->digs[0]);
601 carry = (BNS)(value % den->digs[0]);
610 ndigs = mp_malloc(sizeof(BNS) * (num->size + 1));
612 memcpy(ndigs, num->digs, sizeof(BNS) * num->size);
617 denorm = (BNS)((BNI)CARRY / ((BNI)(den->digs[dpos]) + 1));
623 ndigs[i] = (BNS)value;
624 carry = (BNS)(value >> BNSBITS);
627 ddigs = mp_malloc(sizeof(BNS) * den->size);
628 memcpy(ddigs, den->digs, sizeof(BNS) * den->size);
631 ddigs[i] = (BNS)value;
632 carry = (BNS)(value >> BNSBITS);
643 qest = (BNS)SMASK;
645 qest = (BNS)((((BNI)(ndigs[npos]) << BNSBITS) + ndigs[npos - 1]) /
658 carry = (BNS)(value >> BNSBITS);
661 ndigs[npos - dpos + i - 1] = (BNS)svalue;
666 ndigs[npos] = (BNS)svalue;
674 ndigs[npos - dpos + i - 1] = (BNS)value;
675 carry = (BNS)(value >> BNSBITS);
687 rdigs[j] = (BNS)(value / denorm);
688 carry = (BNS)(value % denorm);
743 BNS ddigs[2];
747 dop.digs = (BNS*)ddigs;
766 BNS ddigs[2];
769 dop.digs = (BNS*)ddigs;
1104 BNS *digs;
1110 rop->digs = mp_realloc(rop->digs, sizeof(BNS) * op->size);
1114 memcpy(rop->digs, op->digs, sizeof(BNS) * op->size);
1143 digs = mp_malloc(sizeof(BNS) * xsize);
1146 rop->digs = mp_realloc(rop->digs, sizeof(BNS) * xsize);
1189 static INLINE BNS
1190 mpi_logic(BNS op1, BNS op2, BNS op)
1205 mpi_log(mpi *rop, mpi *op1, mpi *op2, BNS op)
1209 BNS *digs, *digs1, *digs2; /* pointers to mp data */
1211 BNS sign, sign1, sign2;
1212 BNS n, n1, n2; /* logical operands */
1228 rop->digs = mp_realloc(rop->digs, sizeof(BNS) * size);
1243 sum = (BNI)(BNS)(~digs1[i]) + c1;
1245 n1 = (BNS)sum;
1253 sum = (BNI)(BNS)(~digs2[i]) + c2;
1255 n2 = (BNS)sum;
1262 sum = (BNI)(BNS)(~n) + c;
1264 digs[i] = (BNS)sum;
1308 static BNS digs[1] = { 1 };
1309 static mpi one = { 0, 1, 1, (BNS*)&digs };
1321 rop->digs = mp_realloc(rop->digs, sizeof(BNS) * rop->size);
1325 memcpy(rop->digs, op->digs, sizeof(BNS) * rop->size);
1336 rop->digs = mp_realloc(rop->digs, sizeof(BNS) * rop->size);
1340 memcpy(rop->digs, op->digs, sizeof(BNS) * rop->size);
1470 #define FLOATDIGS sizeof(double) / sizeof(BNS)
1530 static BNS big_bases[37] = {
1540 static BNS big_bases[37] = {
1576 BNS *digs, *xdigs; /* copy of op data */
1605 xdigs = mp_malloc(size * sizeof(BNS));
1606 memcpy(xdigs, op->digs, size * sizeof(BNS));
1613 BNS quotient, remainder = 0;
1628 quotient = (BNS)(value / bigbase);
1629 remainder = (BNS)(value % bigbase);