Lines Matching refs:w

48 x_sign = x.w[1] & MASK_SIGN;	// 0 for positive, MASK_SIGN for negative
49 x_exp = x.w[1] & MASK_EXP; // biased and shifted left 49 bit positions
50 C1.w[1] = x.w[1] & MASK_COEFF;
51 C1.w[0] = x.w[0];
54 if ((x.w[1] & MASK_SPECIAL) == MASK_SPECIAL) {
56 if ((x.w[1] & MASK_NAN) == MASK_NAN) { // x is NAN
57 if ((x.w[1] & MASK_SNAN) == MASK_SNAN) { // x is SNAN
85 if ((C1.w[1] > 0x0001ed09bead87c0ull)
86 || (C1.w[1] == 0x0001ed09bead87c0ull
87 && (C1.w[0] > 0x378d8e63ffffffffull))
88 || ((x.w[1] & 0x6000000000000000ull) == 0x6000000000000000ull)) {
91 } else if ((C1.w[1] == 0x0ull) && (C1.w[0] == 0x0ull)) {
99 if (C1.w[1] == 0) {
100 if (C1.w[0] >= 0x0020000000000000ull) { // x >= 2^53
102 if (C1.w[0] >= 0x0000000100000000ull) { // x >= 2^32
103 tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
107 tmp1.d = (double) (C1.w[0]); // exact conversion
112 tmp1.d = (double) C1.w[0]; // exact conversion
117 tmp1.d = (double) C1.w[1]; // exact conversion
124 if (C1.w[1] > nr_digits[x_nr_bits - 1].threshold_hi
125 || (C1.w[1] == nr_digits[x_nr_bits - 1].threshold_hi
126 && C1.w[0] >= nr_digits[x_nr_bits - 1].threshold_lo))
147 tmp64 = C1.w[0] * ten2k64[11 - q]; // C scaled up to 11-digit int
168 if (C1.w[1] > C.w[1] || (C1.w[1] == C.w[1] && C1.w[0] > C.w[0])) {
183 tmp64 = C1.w[0] * ten2k64[11 - q]; // C scaled up to 11-digit int
204 if (C1.w[1] > C.w[1]
205 || (C1.w[1] == C.w[1] && C1.w[0] >= C.w[0])) {
232 if ((C1.w[1] == 0) && (C1.w[0] <= midpoint64[ind])) {
241 if ((C1.w[1] < midpoint128[ind - 19].w[1])
242 || ((C1.w[1] == midpoint128[ind - 19].w[1])
243 && (C1.w[0] <= midpoint128[ind - 19].w[0]))) {
266 tmp64 = C1.w[0];
268 C1.w[0] = C1.w[0] + midpoint64[ind - 1];
270 C1.w[0] = C1.w[0] + midpoint128[ind - 20].w[0];
271 C1.w[1] = C1.w[1] + midpoint128[ind - 20].w[1];
273 if (C1.w[0] < tmp64)
274 C1.w[1]++;
285 Cstar.w[1] = P256.w[3];
286 Cstar.w[0] = P256.w[2];
287 fstar.w[3] = 0;
288 fstar.w[2] = P256.w[2] & maskhigh128[ind - 1];
289 fstar.w[1] = P256.w[1];
290 fstar.w[0] = P256.w[0];
292 Cstar.w[1] = 0;
293 Cstar.w[0] = P256.w[3];
294 fstar.w[3] = P256.w[3] & maskhigh128[ind - 1];
295 fstar.w[2] = P256.w[2];
296 fstar.w[1] = P256.w[1];
297 fstar.w[0] = P256.w[0];
314 Cstar.w[0] =
315 (Cstar.w[0] >> shift) | (Cstar.w[1] << (64 - shift));
318 Cstar.w[0] = (Cstar.w[0] >> (shift - 64)); // 2 <= shift - 64 <= 38
323 if ((fstar.w[3] == 0) && (fstar.w[2] == 0)
324 && (fstar.w[1] || fstar.w[0])
325 && (fstar.w[1] < ten2mk128trunc[ind - 1].w[1]
326 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
327 && fstar.w[0] <= ten2mk128trunc[ind - 1].w[0]))) {
329 if (Cstar.w[0] & 0x01) { // Cstar.w[0] is odd; MP in [EVEN, ODD]
331 Cstar.w[0]--; // Cstar.w[0] is now even
334 res = Cstar.w[0]; // the result is positive
338 res = C1.w[0];
341 res = C1.w[0] * ten2k64[exp];
372 x_sign = x.w[1] & MASK_SIGN; // 0 for positive, MASK_SIGN for negative
373 x_exp = x.w[1] & MASK_EXP; // biased and shifted left 49 bit positions
374 C1.w[1] = x.w[1] & MASK_COEFF;
375 C1.w[0] = x.w[0];
378 if ((x.w[1] & MASK_SPECIAL) == MASK_SPECIAL) {
380 if ((x.w[1] & MASK_NAN) == MASK_NAN) { // x is NAN
381 if ((x.w[1] & MASK_SNAN) == MASK_SNAN) { // x is SNAN
409 if ((C1.w[1] > 0x0001ed09bead87c0ull)
410 || (C1.w[1] == 0x0001ed09bead87c0ull
411 && (C1.w[0] > 0x378d8e63ffffffffull))
412 || ((x.w[1] & 0x6000000000000000ull) == 0x6000000000000000ull)) {
415 } else if ((C1.w[1] == 0x0ull) && (C1.w[0] == 0x0ull)) {
423 if (C1.w[1] == 0) {
424 if (C1.w[0] >= 0x0020000000000000ull) { // x >= 2^53
426 if (C1.w[0] >= 0x0000000100000000ull) { // x >= 2^32
427 tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
431 tmp1.d = (double) (C1.w[0]); // exact conversion
436 tmp1.d = (double) C1.w[0]; // exact conversion
441 tmp1.d = (double) C1.w[1]; // exact conversion
448 if (C1.w[1] > nr_digits[x_nr_bits - 1].threshold_hi
449 || (C1.w[1] == nr_digits[x_nr_bits - 1].threshold_hi
450 && C1.w[0] >= nr_digits[x_nr_bits - 1].threshold_lo))
471 tmp64 = C1.w[0] * ten2k64[11 - q]; // C scaled up to 11-digit int
492 if (C1.w[1] > C.w[1] || (C1.w[1] == C.w[1] && C1.w[0] > C.w[0])) {
507 tmp64 = C1.w[0] * ten2k64[11 - q]; // C scaled up to 11-digit int
528 if (C1.w[1] > C.w[1]
529 || (C1.w[1] == C.w[1] && C1.w[0] >= C.w[0])) {
558 if ((C1.w[1] == 0) && (C1.w[0] <= midpoint64[ind])) {
568 if ((C1.w[1] < midpoint128[ind - 19].w[1])
569 || ((C1.w[1] == midpoint128[ind - 19].w[1])
570 && (C1.w[0] <= midpoint128[ind - 19].w[0]))) {
596 tmp64 = C1.w[0];
598 C1.w[0] = C1.w[0] + midpoint64[ind - 1];
600 C1.w[0] = C1.w[0] + midpoint128[ind - 20].w[0];
601 C1.w[1] = C1.w[1] + midpoint128[ind - 20].w[1];
603 if (C1.w[0] < tmp64)
604 C1.w[1]++;
615 Cstar.w[1] = P256.w[3];
616 Cstar.w[0] = P256.w[2];
617 fstar.w[3] = 0;
618 fstar.w[2] = P256.w[2] & maskhigh128[ind - 1];
619 fstar.w[1] = P256.w[1];
620 fstar.w[0] = P256.w[0];
622 Cstar.w[1] = 0;
623 Cstar.w[0] = P256.w[3];
624 fstar.w[3] = P256.w[3] & maskhigh128[ind - 1];
625 fstar.w[2] = P256.w[2];
626 fstar.w[1] = P256.w[1];
627 fstar.w[0] = P256.w[0];
644 Cstar.w[0] =
645 (Cstar.w[0] >> shift) | (Cstar.w[1] << (64 - shift));
648 Cstar.w[0] = (Cstar.w[0] >> (shift - 64)); // 2 <= shift - 64 <= 38
656 if (fstar.w[1] > 0x8000000000000000ull ||
657 (fstar.w[1] == 0x8000000000000000ull
658 && fstar.w[0] > 0x0ull)) {
660 tmp64 = fstar.w[1] - 0x8000000000000000ull; // f* - 1/2
661 if (tmp64 > ten2mk128trunc[ind - 1].w[1]
662 || (tmp64 == ten2mk128trunc[ind - 1].w[1]
663 && fstar.w[0] >= ten2mk128trunc[ind - 1].w[0])) {
674 if (fstar.w[3] > 0x0 ||
675 (fstar.w[3] == 0x0 && fstar.w[2] > onehalf128[ind - 1]) ||
676 (fstar.w[3] == 0x0 && fstar.w[2] == onehalf128[ind - 1] &&
677 (fstar.w[1] || fstar.w[0]))) {
680 tmp64 = fstar.w[2] - onehalf128[ind - 1];
681 tmp64A = fstar.w[3];
682 if (tmp64 > fstar.w[2])
685 || fstar.w[1] > ten2mk128trunc[ind - 1].w[1]
686 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
687 && fstar.w[0] > ten2mk128trunc[ind - 1].w[0])) {
698 if (fstar.w[3] > onehalf128[ind - 1] ||
699 (fstar.w[3] == onehalf128[ind - 1] &&
700 (fstar.w[2] || fstar.w[1] || fstar.w[0]))) {
703 tmp64 = fstar.w[3] - onehalf128[ind - 1];
704 if (tmp64 || fstar.w[2]
705 || fstar.w[1] > ten2mk128trunc[ind - 1].w[1]
706 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
707 && fstar.w[0] > ten2mk128trunc[ind - 1].w[0])) {
722 if ((fstar.w[3] == 0) && (fstar.w[2] == 0)
723 && (fstar.w[1] || fstar.w[0])
724 && (fstar.w[1] < ten2mk128trunc[ind - 1].w[1]
725 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
726 && fstar.w[0] <= ten2mk128trunc[ind - 1].w[0]))) {
728 if (Cstar.w[0] & 0x01) { // Cstar.w[0] is odd; MP in [EVEN, ODD]
730 Cstar.w[0]--; // Cstar.w[0] is now even
733 res = Cstar.w[0]; // the result is positive
739 res = C1.w[0];
742 res = C1.w[0] * ten2k64[exp];
774 x_sign = x.w[1] & MASK_SIGN; // 0 for positive, MASK_SIGN for negative
775 x_exp = x.w[1] & MASK_EXP; // biased and shifted left 49 bit positions
776 C1.w[1] = x.w[1] & MASK_COEFF;
777 C1.w[0] = x.w[0];
780 if ((x.w[1] & MASK_SPECIAL) == MASK_SPECIAL) {
782 if ((x.w[1] & MASK_NAN) == MASK_NAN) { // x is NAN
783 if ((x.w[1] & MASK_SNAN) == MASK_SNAN) { // x is SNAN
811 if ((C1.w[1] > 0x0001ed09bead87c0ull)
812 || (C1.w[1] == 0x0001ed09bead87c0ull
813 && (C1.w[0] > 0x378d8e63ffffffffull))
814 || ((x.w[1] & 0x6000000000000000ull) == 0x6000000000000000ull)) {
817 } else if ((C1.w[1] == 0x0ull) && (C1.w[0] == 0x0ull)) {
833 if (C1.w[1] == 0) {
834 if (C1.w[0] >= 0x0020000000000000ull) { // x >= 2^53
836 if (C1.w[0] >= 0x0000000100000000ull) { // x >= 2^32
837 tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
841 tmp1.d = (double) (C1.w[0]); // exact conversion
846 tmp1.d = (double) C1.w[0]; // exact conversion
851 tmp1.d = (double) C1.w[1]; // exact conversion
858 if (C1.w[1] > nr_digits[x_nr_bits - 1].threshold_hi
859 || (C1.w[1] == nr_digits[x_nr_bits - 1].threshold_hi
860 && C1.w[0] >= nr_digits[x_nr_bits - 1].threshold_lo))
882 tmp64 = C1.w[0] * ten2k64[11 - q]; // C scaled up to 11-digit int
903 if (C1.w[1] > C.w[1] || (C1.w[1] == C.w[1] && C1.w[0] >= C.w[0])) {
927 tmp64 = C1.w[0];
929 C1.w[0] = C1.w[0] + midpoint64[ind - 1];
931 C1.w[0] = C1.w[0] + midpoint128[ind - 20].w[0];
932 C1.w[1] = C1.w[1] + midpoint128[ind - 20].w[1];
934 if (C1.w[0] < tmp64)
935 C1.w[1]++;
946 Cstar.w[1] = P256.w[3];
947 Cstar.w[0] = P256.w[2];
948 fstar.w[3] = 0;
949 fstar.w[2] = P256.w[2] & maskhigh128[ind - 1];
950 fstar.w[1] = P256.w[1];
951 fstar.w[0] = P256.w[0];
953 Cstar.w[1] = 0;
954 Cstar.w[0] = P256.w[3];
955 fstar.w[3] = P256.w[3] & maskhigh128[ind - 1];
956 fstar.w[2] = P256.w[2];
957 fstar.w[1] = P256.w[1];
958 fstar.w[0] = P256.w[0];
975 Cstar.w[0] =
976 (Cstar.w[0] >> shift) | (Cstar.w[1] << (64 - shift));
979 Cstar.w[0] = (Cstar.w[0] >> (shift - 64)); // 2 <= shift - 64 <= 38
987 if (fstar.w[1] > 0x8000000000000000ull ||
988 (fstar.w[1] == 0x8000000000000000ull
989 && fstar.w[0] > 0x0ull)) {
991 tmp64 = fstar.w[1] - 0x8000000000000000ull; // f* - 1/2
992 if (tmp64 > ten2mk128trunc[ind - 1].w[1]
993 || (tmp64 == ten2mk128trunc[ind - 1].w[1]
994 && fstar.w[0] >= ten2mk128trunc[ind - 1].w[0])) {
1000 if (fstar.w[3] > 0x0 ||
1001 (fstar.w[3] == 0x0 && fstar.w[2] > onehalf128[ind - 1]) ||
1002 (fstar.w[3] == 0x0 && fstar.w[2] == onehalf128[ind - 1] &&
1003 (fstar.w[1] || fstar.w[0]))) {
1006 tmp64 = fstar.w[2] - onehalf128[ind - 1];
1007 tmp64A = fstar.w[3];
1008 if (tmp64 > fstar.w[2])
1011 || fstar.w[1] > ten2mk128trunc[ind - 1].w[1]
1012 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
1013 && fstar.w[0] > ten2mk128trunc[ind - 1].w[0])) {
1019 if (fstar.w[3] > onehalf128[ind - 1] ||
1020 (fstar.w[3] == onehalf128[ind - 1] &&
1021 (fstar.w[2] || fstar.w[1] || fstar.w[0]))) {
1024 tmp64 = fstar.w[3] - onehalf128[ind - 1];
1025 if (tmp64 || fstar.w[2]
1026 || fstar.w[1] > ten2mk128trunc[ind - 1].w[1]
1027 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
1028 && fstar.w[0] > ten2mk128trunc[ind - 1].w[0])) {
1038 if ((fstar.w[3] == 0) && (fstar.w[2] == 0)
1039 && (fstar.w[1] || fstar.w[0])
1040 && (fstar.w[1] < ten2mk128trunc[ind - 1].w[1]
1041 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
1042 && fstar.w[0] <= ten2mk128trunc[ind - 1].w[0]))) {
1044 if (Cstar.w[0] & 0x01) { // Cstar.w[0] is odd; MP in [EVEN, ODD]
1046 Cstar.w[0]--; // Cstar.w[0] is now even
1055 Cstar.w[0] = Cstar.w[0] - 1;
1059 res = Cstar.w[0];
1063 res = C1.w[0];
1066 res = C1.w[0] * ten2k64[exp];
1098 x_sign = x.w[1] & MASK_SIGN; // 0 for positive, MASK_SIGN for negative
1099 x_exp = x.w[1] & MASK_EXP; // biased and shifted left 49 bit positions
1100 C1.w[1] = x.w[1] & MASK_COEFF;
1101 C1.w[0] = x.w[0];
1104 if ((x.w[1] & MASK_SPECIAL) == MASK_SPECIAL) {
1106 if ((x.w[1] & MASK_NAN) == MASK_NAN) { // x is NAN
1107 if ((x.w[1] & MASK_SNAN) == MASK_SNAN) { // x is SNAN
1135 if ((C1.w[1] > 0x0001ed09bead87c0ull)
1136 || (C1.w[1] == 0x0001ed09bead87c0ull
1137 && (C1.w[0] > 0x378d8e63ffffffffull))
1138 || ((x.w[1] & 0x6000000000000000ull) == 0x6000000000000000ull)) {
1141 } else if ((C1.w[1] == 0x0ull) && (C1.w[0] == 0x0ull)) {
1157 if (C1.w[1] == 0) {
1158 if (C1.w[0] >= 0x0020000000000000ull) { // x >= 2^53
1160 if (C1.w[0] >= 0x0000000100000000ull) { // x >= 2^32
1161 tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
1165 tmp1.d = (double) (C1.w[0]); // exact conversion
1170 tmp1.d = (double) C1.w[0]; // exact conversion
1175 tmp1.d = (double) C1.w[1]; // exact conversion
1182 if (C1.w[1] > nr_digits[x_nr_bits - 1].threshold_hi
1183 || (C1.w[1] == nr_digits[x_nr_bits - 1].threshold_hi
1184 && C1.w[0] >= nr_digits[x_nr_bits - 1].threshold_lo))
1205 tmp64 = C1.w[0] * ten2k64[11 - q]; // C scaled up to 11-digit int
1226 if (C1.w[1] > C.w[1] || (C1.w[1] == C.w[1] && C1.w[0] >= C.w[0])) {
1252 tmp64 = C1.w[0];
1254 C1.w[0] = C1.w[0] + midpoint64[ind - 1];
1256 C1.w[0] = C1.w[0] + midpoint128[ind - 20].w[0];
1257 C1.w[1] = C1.w[1] + midpoint128[ind - 20].w[1];
1259 if (C1.w[0] < tmp64)
1260 C1.w[1]++;
1271 Cstar.w[1] = P256.w[3];
1272 Cstar.w[0] = P256.w[2];
1273 fstar.w[3] = 0;
1274 fstar.w[2] = P256.w[2] & maskhigh128[ind - 1];
1275 fstar.w[1] = P256.w[1];
1276 fstar.w[0] = P256.w[0];
1278 Cstar.w[1] = 0;
1279 Cstar.w[0] = P256.w[3];
1280 fstar.w[3] = P256.w[3] & maskhigh128[ind - 1];
1281 fstar.w[2] = P256.w[2];
1282 fstar.w[1] = P256.w[1];
1283 fstar.w[0] = P256.w[0];
1300 Cstar.w[0] =
1301 (Cstar.w[0] >> shift) | (Cstar.w[1] << (64 - shift));
1304 Cstar.w[0] = (Cstar.w[0] >> (shift - 64)); // 2 <= shift - 64 <= 38
1312 if (fstar.w[1] > 0x8000000000000000ull ||
1313 (fstar.w[1] == 0x8000000000000000ull
1314 && fstar.w[0] > 0x0ull)) {
1316 tmp64 = fstar.w[1] - 0x8000000000000000ull; // f* - 1/2
1317 if (tmp64 > ten2mk128trunc[ind - 1].w[1]
1318 || (tmp64 == ten2mk128trunc[ind - 1].w[1]
1319 && fstar.w[0] >= ten2mk128trunc[ind - 1].w[0])) {
1329 if (fstar.w[3] > 0x0 ||
1330 (fstar.w[3] == 0x0 && fstar.w[2] > onehalf128[ind - 1]) ||
1331 (fstar.w[3] == 0x0 && fstar.w[2] == onehalf128[ind - 1] &&
1332 (fstar.w[1] || fstar.w[0]))) {
1335 tmp64 = fstar.w[2] - onehalf128[ind - 1];
1336 tmp64A = fstar.w[3];
1337 if (tmp64 > fstar.w[2])
1340 || fstar.w[1] > ten2mk128trunc[ind - 1].w[1]
1341 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
1342 && fstar.w[0] > ten2mk128trunc[ind - 1].w[0])) {
1352 if (fstar.w[3] > onehalf128[ind - 1] ||
1353 (fstar.w[3] == onehalf128[ind - 1] &&
1354 (fstar.w[2] || fstar.w[1] || fstar.w[0]))) {
1357 tmp64 = fstar.w[3] - onehalf128[ind - 1];
1358 if (tmp64 || fstar.w[2]
1359 || fstar.w[1] > ten2mk128trunc[ind - 1].w[1]
1360 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
1361 && fstar.w[0] > ten2mk128trunc[ind - 1].w[0])) {
1375 if ((fstar.w[3] == 0) && (fstar.w[2] == 0)
1376 && (fstar.w[1] || fstar.w[0])
1377 && (fstar.w[1] < ten2mk128trunc[ind - 1].w[1]
1378 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
1379 && fstar.w[0] <= ten2mk128trunc[ind - 1].w[0]))) {
1381 if (Cstar.w[0] & 0x01) { // Cstar.w[0] is odd; MP in [EVEN, ODD]
1383 Cstar.w[0]--; // Cstar.w[0] is now even
1392 Cstar.w[0] = Cstar.w[0] - 1;
1396 res = Cstar.w[0];
1400 res = C1.w[0];
1403 res = C1.w[0] * ten2k64[exp];
1435 x_sign = x.w[1] & MASK_SIGN; // 0 for positive, MASK_SIGN for negative
1436 x_exp = x.w[1] & MASK_EXP; // biased and shifted left 49 bit positions
1437 C1.w[1] = x.w[1] & MASK_COEFF;
1438 C1.w[0] = x.w[0];
1441 if ((x.w[1] & MASK_SPECIAL) == MASK_SPECIAL) {
1443 if ((x.w[1] & MASK_NAN) == MASK_NAN) { // x is NAN
1444 if ((x.w[1] & MASK_SNAN) == MASK_SNAN) { // x is SNAN
1472 if ((C1.w[1] > 0x0001ed09bead87c0ull)
1473 || (C1.w[1] == 0x0001ed09bead87c0ull
1474 && (C1.w[0] > 0x378d8e63ffffffffull))
1475 || ((x.w[1] & 0x6000000000000000ull) == 0x6000000000000000ull)) {
1478 } else if ((C1.w[1] == 0x0ull) && (C1.w[0] == 0x0ull)) {
1486 if (C1.w[1] == 0) {
1487 if (C1.w[0] >= 0x0020000000000000ull) { // x >= 2^53
1489 if (C1.w[0] >= 0x0000000100000000ull) { // x >= 2^32
1490 tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
1494 tmp1.d = (double) (C1.w[0]); // exact conversion
1499 tmp1.d = (double) C1.w[0]; // exact conversion
1504 tmp1.d = (double) C1.w[1]; // exact conversion
1511 if (C1.w[1] > nr_digits[x_nr_bits - 1].threshold_hi
1512 || (C1.w[1] == nr_digits[x_nr_bits - 1].threshold_hi
1513 && C1.w[0] >= nr_digits[x_nr_bits - 1].threshold_lo))
1535 tmp64 = C1.w[0] * ten2k64[11 - q]; // C scaled up to 11-digit int
1556 if (C1.w[1] > C.w[1]
1557 || (C1.w[1] == C.w[1] && C1.w[0] >= C.w[0])) {
1572 tmp64 = C1.w[0] * ten2k64[11 - q]; // C scaled up to 11-digit int
1593 if (C1.w[1] > C.w[1] || (C1.w[1] == C.w[1] && C1.w[0] > C.w[0])) {
1630 tmp64 = C1.w[0];
1632 C1.w[0] = C1.w[0] + midpoint64[ind - 1];
1634 C1.w[0] = C1.w[0] + midpoint128[ind - 20].w[0];
1635 C1.w[1] = C1.w[1] + midpoint128[ind - 20].w[1];
1637 if (C1.w[0] < tmp64)
1638 C1.w[1]++;
1649 Cstar.w[1] = P256.w[3];
1650 Cstar.w[0] = P256.w[2];
1651 fstar.w[3] = 0;
1652 fstar.w[2] = P256.w[2] & maskhigh128[ind - 1];
1653 fstar.w[1] = P256.w[1];
1654 fstar.w[0] = P256.w[0];
1656 Cstar.w[1] = 0;
1657 Cstar.w[0] = P256.w[3];
1658 fstar.w[3] = P256.w[3] & maskhigh128[ind - 1];
1659 fstar.w[2] = P256.w[2];
1660 fstar.w[1] = P256.w[1];
1661 fstar.w[0] = P256.w[0];
1678 Cstar.w[0] =
1679 (Cstar.w[0] >> shift) | (Cstar.w[1] << (64 - shift));
1682 Cstar.w[0] = (Cstar.w[0] >> (shift - 64)); // 2 <= shift - 64 <= 38
1690 if (fstar.w[1] > 0x8000000000000000ull ||
1691 (fstar.w[1] == 0x8000000000000000ull
1692 && fstar.w[0] > 0x0ull)) {
1694 tmp64 = fstar.w[1] - 0x8000000000000000ull; // f* - 1/2
1695 if (tmp64 > ten2mk128trunc[ind - 1].w[1]
1696 || (tmp64 == ten2mk128trunc[ind - 1].w[1]
1697 && fstar.w[0] >= ten2mk128trunc[ind - 1].w[0])) {
1704 if (fstar.w[3] > 0x0 ||
1705 (fstar.w[3] == 0x0 && fstar.w[2] > onehalf128[ind - 1]) ||
1706 (fstar.w[3] == 0x0 && fstar.w[2] == onehalf128[ind - 1] &&
1707 (fstar.w[1] || fstar.w[0]))) {
1710 tmp64 = fstar.w[2] - onehalf128[ind - 1];
1711 tmp64A = fstar.w[3];
1712 if (tmp64 > fstar.w[2])
1715 || fstar.w[1] > ten2mk128trunc[ind - 1].w[1]
1716 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
1717 && fstar.w[0] > ten2mk128trunc[ind - 1].w[0])) {
1723 if (fstar.w[3] > onehalf128[ind - 1] ||
1724 (fstar.w[3] == onehalf128[ind - 1] &&
1725 (fstar.w[2] || fstar.w[1] || fstar.w[0]))) {
1728 tmp64 = fstar.w[3] - onehalf128[ind - 1];
1729 if (tmp64 || fstar.w[2]
1730 || fstar.w[1] > ten2mk128trunc[ind - 1].w[1]
1731 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
1732 && fstar.w[0] > ten2mk128trunc[ind - 1].w[0])) {
1743 if ((fstar.w[3] == 0) && (fstar.w[2] == 0)
1744 && (fstar.w[1] || fstar.w[0])
1745 && (fstar.w[1] < ten2mk128trunc[ind - 1].w[1]
1746 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
1747 && fstar.w[0] <= ten2mk128trunc[ind - 1].w[0]))) {
1749 if (Cstar.w[0] & 0x01) { // Cstar.w[0] is odd; MP in [EVEN, ODD]
1751 Cstar.w[0]--; // Cstar.w[0] is now even
1760 Cstar.w[0] = Cstar.w[0] + 1;
1764 res = Cstar.w[0];
1768 res = C1.w[0];
1771 res = C1.w[0] * ten2k64[exp];
1803 x_sign = x.w[1] & MASK_SIGN; // 0 for positive, MASK_SIGN for negative
1804 x_exp = x.w[1] & MASK_EXP; // biased and shifted left 49 bit positions
1805 C1.w[1] = x.w[1] & MASK_COEFF;
1806 C1.w[0] = x.w[0];
1809 if ((x.w[1] & MASK_SPECIAL) == MASK_SPECIAL) {
1811 if ((x.w[1] & MASK_NAN) == MASK_NAN) { // x is NAN
1812 if ((x.w[1] & MASK_SNAN) == MASK_SNAN) { // x is SNAN
1840 if ((C1.w[1] > 0x0001ed09bead87c0ull)
1841 || (C1.w[1] == 0x0001ed09bead87c0ull
1842 && (C1.w[0] > 0x378d8e63ffffffffull))
1843 || ((x.w[1] & 0x6000000000000000ull) == 0x6000000000000000ull)) {
1846 } else if ((C1.w[1] == 0x0ull) && (C1.w[0] == 0x0ull)) {
1854 if (C1.w[1] == 0) {
1855 if (C1.w[0] >= 0x0020000000000000ull) { // x >= 2^53
1857 if (C1.w[0] >= 0x0000000100000000ull) { // x >= 2^32
1858 tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
1862 tmp1.d = (double) (C1.w[0]); // exact conversion
1867 tmp1.d = (double) C1.w[0]; // exact conversion
1872 tmp1.d = (double) C1.w[1]; // exact conversion
1879 if (C1.w[1] > nr_digits[x_nr_bits - 1].threshold_hi
1880 || (C1.w[1] == nr_digits[x_nr_bits - 1].threshold_hi
1881 && C1.w[0] >= nr_digits[x_nr_bits - 1].threshold_lo))
1902 tmp64 = C1.w[0] * ten2k64[11 - q]; // C scaled up to 11-digit int
1923 if (C1.w[1] > C.w[1]
1924 || (C1.w[1] == C.w[1] && C1.w[0] >= C.w[0])) {
1939 tmp64 = C1.w[0] * ten2k64[11 - q]; // C scaled up to 11-digit int
1960 if (C1.w[1] > C.w[1] || (C1.w[1] == C.w[1] && C1.w[0] > C.w[0])) {
1999 tmp64 = C1.w[0];
2001 C1.w[0] = C1.w[0] + midpoint64[ind - 1];
2003 C1.w[0] = C1.w[0] + midpoint128[ind - 20].w[0];
2004 C1.w[1] = C1.w[1] + midpoint128[ind - 20].w[1];
2006 if (C1.w[0] < tmp64)
2007 C1.w[1]++;
2018 Cstar.w[1] = P256.w[3];
2019 Cstar.w[0] = P256.w[2];
2020 fstar.w[3] = 0;
2021 fstar.w[2] = P256.w[2] & maskhigh128[ind - 1];
2022 fstar.w[1] = P256.w[1];
2023 fstar.w[0] = P256.w[0];
2025 Cstar.w[1] = 0;
2026 Cstar.w[0] = P256.w[3];
2027 fstar.w[3] = P256.w[3] & maskhigh128[ind - 1];
2028 fstar.w[2] = P256.w[2];
2029 fstar.w[1] = P256.w[1];
2030 fstar.w[0] = P256.w[0];
2047 Cstar.w[0] =
2048 (Cstar.w[0] >> shift) | (Cstar.w[1] << (64 - shift));
2051 Cstar.w[0] = (Cstar.w[0] >> (shift - 64)); // 2 <= shift - 64 <= 38
2059 if (fstar.w[1] > 0x8000000000000000ull ||
2060 (fstar.w[1] == 0x8000000000000000ull
2061 && fstar.w[0] > 0x0ull)) {
2063 tmp64 = fstar.w[1] - 0x8000000000000000ull; // f* - 1/2
2064 if (tmp64 > ten2mk128trunc[ind - 1].w[1]
2065 || (tmp64 == ten2mk128trunc[ind - 1].w[1]
2066 && fstar.w[0] >= ten2mk128trunc[ind - 1].w[0])) {
2076 if (fstar.w[3] > 0x0 ||
2077 (fstar.w[3] == 0x0 && fstar.w[2] > onehalf128[ind - 1]) ||
2078 (fstar.w[3] == 0x0 && fstar.w[2] == onehalf128[ind - 1] &&
2079 (fstar.w[1] || fstar.w[0]))) {
2082 tmp64 = fstar.w[2] - onehalf128[ind - 1];
2083 tmp64A = fstar.w[3];
2084 if (tmp64 > fstar.w[2])
2087 || fstar.w[1] > ten2mk128trunc[ind - 1].w[1]
2088 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
2089 && fstar.w[0] > ten2mk128trunc[ind - 1].w[0])) {
2099 if (fstar.w[3] > onehalf128[ind - 1] ||
2100 (fstar.w[3] == onehalf128[ind - 1] &&
2101 (fstar.w[2] || fstar.w[1] || fstar.w[0]))) {
2104 tmp64 = fstar.w[3] - onehalf128[ind - 1];
2105 if (tmp64 || fstar.w[2]
2106 || fstar.w[1] > ten2mk128trunc[ind - 1].w[1]
2107 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
2108 && fstar.w[0] > ten2mk128trunc[ind - 1].w[0])) {
2122 if ((fstar.w[3] == 0) && (fstar.w[2] == 0)
2123 && (fstar.w[1] || fstar.w[0])
2124 && (fstar.w[1] < ten2mk128trunc[ind - 1].w[1]
2125 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
2126 && fstar.w[0] <= ten2mk128trunc[ind - 1].w[0]))) {
2128 if (Cstar.w[0] & 0x01) { // Cstar.w[0] is odd; MP in [EVEN, ODD]
2130 Cstar.w[0]--; // Cstar.w[0] is now even
2139 Cstar.w[0] = Cstar.w[0] + 1;
2143 res = Cstar.w[0];
2147 res = C1.w[0];
2150 res = C1.w[0] * ten2k64[exp];
2182 x_sign = x.w[1] & MASK_SIGN; // 0 for positive, MASK_SIGN for negative
2183 x_exp = x.w[1] & MASK_EXP; // biased and shifted left 49 bit positions
2184 C1.w[1] = x.w[1] & MASK_COEFF;
2185 C1.w[0] = x.w[0];
2188 if ((x.w[1] & MASK_SPECIAL) == MASK_SPECIAL) {
2190 if ((x.w[1] & MASK_NAN) == MASK_NAN) { // x is NAN
2191 if ((x.w[1] & MASK_SNAN) == MASK_SNAN) { // x is SNAN
2219 if ((C1.w[1] > 0x0001ed09bead87c0ull)
2220 || (C1.w[1] == 0x0001ed09bead87c0ull
2221 && (C1.w[0] > 0x378d8e63ffffffffull))
2222 || ((x.w[1] & 0x6000000000000000ull) == 0x6000000000000000ull)) {
2225 } else if ((C1.w[1] == 0x0ull) && (C1.w[0] == 0x0ull)) {
2233 if (C1.w[1] == 0) {
2234 if (C1.w[0] >= 0x0020000000000000ull) { // x >= 2^53
2236 if (C1.w[0] >= 0x0000000100000000ull) { // x >= 2^32
2237 tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
2241 tmp1.d = (double) (C1.w[0]); // exact conversion
2246 tmp1.d = (double) C1.w[0]; // exact conversion
2251 tmp1.d = (double) C1.w[1]; // exact conversion
2258 if (C1.w[1] > nr_digits[x_nr_bits - 1].threshold_hi
2259 || (C1.w[1] == nr_digits[x_nr_bits - 1].threshold_hi
2260 && C1.w[0] >= nr_digits[x_nr_bits - 1].threshold_lo))
2281 tmp64 = C1.w[0] * ten2k64[11 - q]; // C scaled up to 11-digit int
2302 if (C1.w[1] > C.w[1]
2303 || (C1.w[1] == C.w[1] && C1.w[0] >= C.w[0])) {
2318 tmp64 = C1.w[0] * ten2k64[11 - q]; // C scaled up to 11-digit int
2339 if (C1.w[1] > C.w[1]
2340 || (C1.w[1] == C.w[1] && C1.w[0] >= C.w[0])) {
2374 tmp64 = C1.w[0];
2376 C1.w[0] = C1.w[0] + midpoint64[ind - 1];
2378 C1.w[0] = C1.w[0] + midpoint128[ind - 20].w[0];
2379 C1.w[1] = C1.w[1] + midpoint128[ind - 20].w[1];
2381 if (C1.w[0] < tmp64)
2382 C1.w[1]++;
2393 Cstar.w[1] = P256.w[3];
2394 Cstar.w[0] = P256.w[2];
2395 fstar.w[3] = 0;
2396 fstar.w[2] = P256.w[2] & maskhigh128[ind - 1];
2397 fstar.w[1] = P256.w[1];
2398 fstar.w[0] = P256.w[0];
2400 Cstar.w[1] = 0;
2401 Cstar.w[0] = P256.w[3];
2402 fstar.w[3] = P256.w[3] & maskhigh128[ind - 1];
2403 fstar.w[2] = P256.w[2];
2404 fstar.w[1] = P256.w[1];
2405 fstar.w[0] = P256.w[0];
2422 Cstar.w[0] =
2423 (Cstar.w[0] >> shift) | (Cstar.w[1] << (64 - shift));
2426 Cstar.w[0] = (Cstar.w[0] >> (shift - 64)); // 2 <= shift - 64 <= 38
2434 if (fstar.w[1] > 0x8000000000000000ull ||
2435 (fstar.w[1] == 0x8000000000000000ull
2436 && fstar.w[0] > 0x0ull)) {
2438 tmp64 = fstar.w[1] - 0x8000000000000000ull; // f* - 1/2
2439 if (tmp64 > ten2mk128trunc[ind - 1].w[1]
2440 || (tmp64 == ten2mk128trunc[ind - 1].w[1]
2441 && fstar.w[0] >= ten2mk128trunc[ind - 1].w[0])) {
2447 if (fstar.w[3] > 0x0 ||
2448 (fstar.w[3] == 0x0 && fstar.w[2] > onehalf128[ind - 1]) ||
2449 (fstar.w[3] == 0x0 && fstar.w[2] == onehalf128[ind - 1] &&
2450 (fstar.w[1] || fstar.w[0]))) {
2453 tmp64 = fstar.w[2] - onehalf128[ind - 1];
2454 tmp64A = fstar.w[3];
2455 if (tmp64 > fstar.w[2])
2458 || fstar.w[1] > ten2mk128trunc[ind - 1].w[1]
2459 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
2460 && fstar.w[0] > ten2mk128trunc[ind - 1].w[0])) {
2466 if (fstar.w[3] > onehalf128[ind - 1] ||
2467 (fstar.w[3] == onehalf128[ind - 1] &&
2468 (fstar.w[2] || fstar.w[1] || fstar.w[0]))) {
2471 tmp64 = fstar.w[3] - onehalf128[ind - 1];
2472 if (tmp64 || fstar.w[2]
2473 || fstar.w[1] > ten2mk128trunc[ind - 1].w[1]
2474 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
2475 && fstar.w[0] > ten2mk128trunc[ind - 1].w[0])) {
2485 if ((fstar.w[3] == 0) && (fstar.w[2] == 0)
2486 && (fstar.w[1] || fstar.w[0])
2487 && (fstar.w[1] < ten2mk128trunc[ind - 1].w[1]
2488 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
2489 && fstar.w[0] <= ten2mk128trunc[ind - 1].w[0]))) {
2491 if (Cstar.w[0] & 0x01) { // Cstar.w[0] is odd; MP in [EVEN, ODD]
2493 Cstar.w[0]--; // Cstar.w[0] is now even
2502 Cstar.w[0] = Cstar.w[0] - 1;
2506 res = Cstar.w[0];
2510 res = C1.w[0];
2513 res = C1.w[0] * ten2k64[exp];
2545 x_sign = x.w[1] & MASK_SIGN; // 0 for positive, MASK_SIGN for negative
2546 x_exp = x.w[1] & MASK_EXP; // biased and shifted left 49 bit positions
2547 C1.w[1] = x.w[1] & MASK_COEFF;
2548 C1.w[0] = x.w[0];
2551 if ((x.w[1] & MASK_SPECIAL) == MASK_SPECIAL) {
2553 if ((x.w[1] & MASK_NAN) == MASK_NAN) { // x is NAN
2554 if ((x.w[1] & MASK_SNAN) == MASK_SNAN) { // x is SNAN
2582 if ((C1.w[1] > 0x0001ed09bead87c0ull)
2583 || (C1.w[1] == 0x0001ed09bead87c0ull
2584 && (C1.w[0] > 0x378d8e63ffffffffull))
2585 || ((x.w[1] & 0x6000000000000000ull) == 0x6000000000000000ull)) {
2588 } else if ((C1.w[1] == 0x0ull) && (C1.w[0] == 0x0ull)) {
2596 if (C1.w[1] == 0) {
2597 if (C1.w[0] >= 0x0020000000000000ull) { // x >= 2^53
2599 if (C1.w[0] >= 0x0000000100000000ull) { // x >= 2^32
2600 tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
2604 tmp1.d = (double) (C1.w[0]); // exact conversion
2609 tmp1.d = (double) C1.w[0]; // exact conversion
2614 tmp1.d = (double) C1.w[1]; // exact conversion
2621 if (C1.w[1] > nr_digits[x_nr_bits - 1].threshold_hi
2622 || (C1.w[1] == nr_digits[x_nr_bits - 1].threshold_hi
2623 && C1.w[0] >= nr_digits[x_nr_bits - 1].threshold_lo))
2644 tmp64 = C1.w[0] * ten2k64[11 - q]; // C scaled up to 11-digit int
2665 if (C1.w[1] > C.w[1]
2666 || (C1.w[1] == C.w[1] && C1.w[0] >= C.w[0])) {
2681 tmp64 = C1.w[0] * ten2k64[11 - q]; // C scaled up to 11-digit int
2702 if (C1.w[1] > C.w[1]
2703 || (C1.w[1] == C.w[1] && C1.w[0] >= C.w[0])) {
2739 tmp64 = C1.w[0];
2741 C1.w[0] = C1.w[0] + midpoint64[ind - 1];
2743 C1.w[0] = C1.w[0] + midpoint128[ind - 20].w[0];
2744 C1.w[1] = C1.w[1] + midpoint128[ind - 20].w[1];
2746 if (C1.w[0] < tmp64)
2747 C1.w[1]++;
2758 Cstar.w[1] = P256.w[3];
2759 Cstar.w[0] = P256.w[2];
2760 fstar.w[3] = 0;
2761 fstar.w[2] = P256.w[2] & maskhigh128[ind - 1];
2762 fstar.w[1] = P256.w[1];
2763 fstar.w[0] = P256.w[0];
2765 Cstar.w[1] = 0;
2766 Cstar.w[0] = P256.w[3];
2767 fstar.w[3] = P256.w[3] & maskhigh128[ind - 1];
2768 fstar.w[2] = P256.w[2];
2769 fstar.w[1] = P256.w[1];
2770 fstar.w[0] = P256.w[0];
2787 Cstar.w[0] =
2788 (Cstar.w[0] >> shift) | (Cstar.w[1] << (64 - shift));
2791 Cstar.w[0] = (Cstar.w[0] >> (shift - 64)); // 2 <= shift - 64 <= 38
2799 if (fstar.w[1] > 0x8000000000000000ull ||
2800 (fstar.w[1] == 0x8000000000000000ull
2801 && fstar.w[0] > 0x0ull)) {
2803 tmp64 = fstar.w[1] - 0x8000000000000000ull; // f* - 1/2
2804 if (tmp64 > ten2mk128trunc[ind - 1].w[1]
2805 || (tmp64 == ten2mk128trunc[ind - 1].w[1]
2806 && fstar.w[0] >= ten2mk128trunc[ind - 1].w[0])) {
2816 if (fstar.w[3] > 0x0 ||
2817 (fstar.w[3] == 0x0 && fstar.w[2] > onehalf128[ind - 1]) ||
2818 (fstar.w[3] == 0x0 && fstar.w[2] == onehalf128[ind - 1] &&
2819 (fstar.w[1] || fstar.w[0]))) {
2822 tmp64 = fstar.w[2] - onehalf128[ind - 1];
2823 tmp64A = fstar.w[3];
2824 if (tmp64 > fstar.w[2])
2827 || fstar.w[1] > ten2mk128trunc[ind - 1].w[1]
2828 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
2829 && fstar.w[0] > ten2mk128trunc[ind - 1].w[0])) {
2839 if (fstar.w[3] > onehalf128[ind - 1] ||
2840 (fstar.w[3] == onehalf128[ind - 1] &&
2841 (fstar.w[2] || fstar.w[1] || fstar.w[0]))) {
2844 tmp64 = fstar.w[3] - onehalf128[ind - 1];
2845 if (tmp64 || fstar.w[2]
2846 || fstar.w[1] > ten2mk128trunc[ind - 1].w[1]
2847 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
2848 && fstar.w[0] > ten2mk128trunc[ind - 1].w[0])) {
2862 if ((fstar.w[3] == 0) && (fstar.w[2] == 0)
2863 && (fstar.w[1] || fstar.w[0])
2864 && (fstar.w[1] < ten2mk128trunc[ind - 1].w[1]
2865 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
2866 && fstar.w[0] <= ten2mk128trunc[ind - 1].w[0]))) {
2868 if (Cstar.w[0] & 0x01) { // Cstar.w[0] is odd; MP in [EVEN, ODD]
2870 Cstar.w[0]--; // Cstar.w[0] is now even
2879 Cstar.w[0] = Cstar.w[0] - 1;
2883 res = Cstar.w[0];
2887 res = C1.w[0];
2890 res = C1.w[0] * ten2k64[exp];
2919 x_sign = x.w[1] & MASK_SIGN; // 0 for positive, MASK_SIGN for negative
2920 x_exp = x.w[1] & MASK_EXP; // biased and shifted left 49 bit positions
2921 C1.w[1] = x.w[1] & MASK_COEFF;
2922 C1.w[0] = x.w[0];
2925 if ((x.w[1] & MASK_SPECIAL) == MASK_SPECIAL) {
2927 if ((x.w[1] & MASK_NAN) == MASK_NAN) { // x is NAN
2928 if ((x.w[1] & MASK_SNAN) == MASK_SNAN) { // x is SNAN
2956 if ((C1.w[1] > 0x0001ed09bead87c0ull)
2957 || (C1.w[1] == 0x0001ed09bead87c0ull
2958 && (C1.w[0] > 0x378d8e63ffffffffull))
2959 || ((x.w[1] & 0x6000000000000000ull) == 0x6000000000000000ull)) {
2962 } else if ((C1.w[1] == 0x0ull) && (C1.w[0] == 0x0ull)) {
2970 if (C1.w[1] == 0) {
2971 if (C1.w[0] >= 0x0020000000000000ull) { // x >= 2^53
2973 if (C1.w[0] >= 0x0000000100000000ull) { // x >= 2^32
2974 tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
2978 tmp1.d = (double) (C1.w[0]); // exact conversion
2983 tmp1.d = (double) C1.w[0]; // exact conversion
2988 tmp1.d = (double) C1.w[1]; // exact conversion
2995 if (C1.w[1] > nr_digits[x_nr_bits - 1].threshold_hi
2996 || (C1.w[1] == nr_digits[x_nr_bits - 1].threshold_hi
2997 && C1.w[0] >= nr_digits[x_nr_bits - 1].threshold_lo))
3018 tmp64 = C1.w[0] * ten2k64[11 - q]; // C scaled up to 11-digit int
3039 if (C1.w[1] > C.w[1]
3040 || (C1.w[1] == C.w[1] && C1.w[0] >= C.w[0])) {
3055 tmp64 = C1.w[0] * ten2k64[11 - q]; // C scaled up to 11-digit int
3076 if (C1.w[1] > C.w[1]
3077 || (C1.w[1] == C.w[1] && C1.w[0] >= C.w[0])) {
3104 if ((C1.w[1] == 0) && (C1.w[0] < midpoint64[ind])) {
3113 if ((C1.w[1] < midpoint128[ind - 19].w[1])
3114 || ((C1.w[1] == midpoint128[ind - 19].w[1])
3115 && (C1.w[0] < midpoint128[ind - 19].w[0]))) {
3138 tmp64 = C1.w[0];
3140 C1.w[0] = C1.w[0] + midpoint64[ind - 1];
3142 C1.w[0] = C1.w[0] + midpoint128[ind - 20].w[0];
3143 C1.w[1] = C1.w[1] + midpoint128[ind - 20].w[1];
3145 if (C1.w[0] < tmp64)
3146 C1.w[1]++;
3157 Cstar.w[1] = P256.w[3];
3158 Cstar.w[0] = P256.w[2];
3160 Cstar.w[1] = 0;
3161 Cstar.w[0] = P256.w[3];
3178 Cstar.w[0] =
3179 (Cstar.w[0] >> shift) | (Cstar.w[1] << (64 - shift));
3182 Cstar.w[0] = (Cstar.w[0] >> (shift - 64)); // 2 <= shift - 64 <= 38
3185 res = Cstar.w[0]; // always positive
3190 res = C1.w[0];
3193 res = C1.w[0] * ten2k64[exp];
3224 x_sign = x.w[1] & MASK_SIGN; // 0 for positive, MASK_SIGN for negative
3225 x_exp = x.w[1] & MASK_EXP; // biased and shifted left 49 bit positions
3226 C1.w[1] = x.w[1] & MASK_COEFF;
3227 C1.w[0] = x.w[0];
3230 if ((x.w[1] & MASK_SPECIAL) == MASK_SPECIAL) {
3232 if ((x.w[1] & MASK_NAN) == MASK_NAN) { // x is NAN
3233 if ((x.w[1] & MASK_SNAN) == MASK_SNAN) { // x is SNAN
3261 if ((C1.w[1] > 0x0001ed09bead87c0ull)
3262 || (C1.w[1] == 0x0001ed09bead87c0ull
3263 && (C1.w[0] > 0x378d8e63ffffffffull))
3264 || ((x.w[1] & 0x6000000000000000ull) == 0x6000000000000000ull)) {
3267 } else if ((C1.w[1] == 0x0ull) && (C1.w[0] == 0x0ull)) {
3275 if (C1.w[1] == 0) {
3276 if (C1.w[0] >= 0x0020000000000000ull) { // x >= 2^53
3278 if (C1.w[0] >= 0x0000000100000000ull) { // x >= 2^32
3279 tmp1.d = (double) (C1.w[0] >> 32); // exact conversion
3283 tmp1.d = (double) (C1.w[0]); // exact conversion
3288 tmp1.d = (double) C1.w[0]; // exact conversion
3293 tmp1.d = (double) C1.w[1]; // exact conversion
3300 if (C1.w[1] > nr_digits[x_nr_bits - 1].threshold_hi
3301 || (C1.w[1] == nr_digits[x_nr_bits - 1].threshold_hi
3302 && C1.w[0] >= nr_digits[x_nr_bits - 1].threshold_lo))
3323 tmp64 = C1.w[0] * ten2k64[11 - q]; // C scaled up to 11-digit int
3344 if (C1.w[1] > C.w[1]
3345 || (C1.w[1] == C.w[1] && C1.w[0] >= C.w[0])) {
3360 tmp64 = C1.w[0] * ten2k64[11 - q]; // C scaled up to 11-digit int
3381 if (C1.w[1] > C.w[1]
3382 || (C1.w[1] == C.w[1] && C1.w[0] >= C.w[0])) {
3411 if ((C1.w[1] == 0) && (C1.w[0] < midpoint64[ind])) {
3421 if ((C1.w[1] < midpoint128[ind - 19].w[1])
3422 || ((C1.w[1] == midpoint128[ind - 19].w[1])
3423 && (C1.w[0] < midpoint128[ind - 19].w[0]))) {
3449 tmp64 = C1.w[0];
3451 C1.w[0] = C1.w[0] + midpoint64[ind - 1];
3453 C1.w[0] = C1.w[0] + midpoint128[ind - 20].w[0];
3454 C1.w[1] = C1.w[1] + midpoint128[ind - 20].w[1];
3456 if (C1.w[0] < tmp64)
3457 C1.w[1]++;
3468 Cstar.w[1] = P256.w[3];
3469 Cstar.w[0] = P256.w[2];
3470 fstar.w[3] = 0;
3471 fstar.w[2] = P256.w[2] & maskhigh128[ind - 1];
3472 fstar.w[1] = P256.w[1];
3473 fstar.w[0] = P256.w[0];
3475 Cstar.w[1] = 0;
3476 Cstar.w[0] = P256.w[3];
3477 fstar.w[3] = P256.w[3] & maskhigh128[ind - 1];
3478 fstar.w[2] = P256.w[2];
3479 fstar.w[1] = P256.w[1];
3480 fstar.w[0] = P256.w[0];
3497 Cstar.w[0] =
3498 (Cstar.w[0] >> shift) | (Cstar.w[1] << (64 - shift));
3501 Cstar.w[0] = (Cstar.w[0] >> (shift - 64)); // 2 <= shift - 64 <= 38
3510 if (fstar.w[1] > 0x8000000000000000ull ||
3511 (fstar.w[1] == 0x8000000000000000ull
3512 && fstar.w[0] > 0x0ull)) {
3514 tmp64 = fstar.w[1] - 0x8000000000000000ull; // f* - 1/2
3515 if (tmp64 > ten2mk128trunc[ind - 1].w[1]
3516 || (tmp64 == ten2mk128trunc[ind - 1].w[1]
3517 && fstar.w[0] >= ten2mk128trunc[ind - 1].w[0])) {
3528 if (fstar.w[3] > 0x0 ||
3529 (fstar.w[3] == 0x0 && fstar.w[2] > onehalf128[ind - 1]) ||
3530 (fstar.w[3] == 0x0 && fstar.w[2] == onehalf128[ind - 1] &&
3531 (fstar.w[1] || fstar.w[0]))) {
3534 tmp64 = fstar.w[2] - onehalf128[ind - 1];
3535 tmp64A = fstar.w[3];
3536 if (tmp64 > fstar.w[2])
3539 || fstar.w[1] > ten2mk128trunc[ind - 1].w[1]
3540 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
3541 && fstar.w[0] > ten2mk128trunc[ind - 1].w[0])) {
3552 if (fstar.w[3] > onehalf128[ind - 1] ||
3553 (fstar.w[3] == onehalf128[ind - 1] &&
3554 (fstar.w[2] || fstar.w[1] || fstar.w[0]))) {
3557 tmp64 = fstar.w[3] - onehalf128[ind - 1];
3558 if (tmp64 || fstar.w[2]
3559 || fstar.w[1] > ten2mk128trunc[ind - 1].w[1]
3560 || (fstar.w[1] == ten2mk128trunc[ind - 1].w[1]
3561 && fstar.w[0] > ten2mk128trunc[ind - 1].w[0])) {
3573 res = Cstar.w[0]; // the result is positive
3579 res = C1.w[0];
3582 res = C1.w[0] * ten2k64[exp];