90 const uint64_t* right_limbs,
101 result_0 += left_limb * right_limbs[0];
102 result_1 += left_limb * right_limbs[1];
103 result_2 += left_limb * right_limbs[2];
104 result_3 += left_limb * right_limbs[3];
105 result_4 += left_limb * right_limbs[4];
106 result_5 += left_limb * right_limbs[5];
107 result_6 += left_limb * right_limbs[6];
108 result_7 += left_limb * right_limbs[7];
109 result_8 += left_limb * right_limbs[8];
227#if defined(__SIZEOF_INT128__) && !defined(__wasm__)
229 const auto [q0, t1] =
mac(t0,
data[0], other.
data[1], 0);
230 const auto [q1, t2] =
mac(t1,
data[0], other.
data[2], 0);
231 const auto [q2, z0] =
mac(t2,
data[0], other.
data[3], 0);
233 const auto [r1, t3] =
mac(q0,
data[1], other.
data[0], 0);
234 const auto [q3, t4] =
mac(q1,
data[1], other.
data[1], t3);
235 const auto [q4, t5] =
mac(q2,
data[1], other.
data[2], t4);
236 const auto [q5, z1] =
mac(z0,
data[1], other.
data[3], t5);
238 const auto [r2, t6] =
mac(q3,
data[2], other.
data[0], 0);
239 const auto [q6, t7] =
mac(q4,
data[2], other.
data[1], t6);
240 const auto [q7, t8] =
mac(q5,
data[2], other.
data[2], t7);
241 const auto [q8, z2] =
mac(z1,
data[2], other.
data[3], t8);
243 const auto [r3, t9] =
mac(q6,
data[3], other.
data[0], 0);
244 const auto [r4, t10] =
mac(q7,
data[3], other.
data[1], t9);
245 const auto [r5, t11] =
mac(q8,
data[3], other.
data[2], t10);
246 const auto [r6, r7] =
mac(z2,
data[3], other.
data[3], t11);
255 constexpr uint64_t mask = 0x1fffffff;
266 uint64_t temp_10 = 0;
267 uint64_t temp_11 = 0;
268 uint64_t temp_12 = 0;
269 uint64_t temp_13 = 0;
270 uint64_t temp_14 = 0;
271 uint64_t temp_15 = 0;
272 uint64_t temp_16 = 0;
275 wasm_madd(left[0], &right[0], temp_0, temp_1, temp_2, temp_3, temp_4, temp_5, temp_6, temp_7, temp_8);
276 wasm_madd(left[1], &right[0], temp_1, temp_2, temp_3, temp_4, temp_5, temp_6, temp_7, temp_8, temp_9);
277 wasm_madd(left[2], &right[0], temp_2, temp_3, temp_4, temp_5, temp_6, temp_7, temp_8, temp_9, temp_10);
278 wasm_madd(left[3], &right[0], temp_3, temp_4, temp_5, temp_6, temp_7, temp_8, temp_9, temp_10, temp_11);
279 wasm_madd(left[4], &right[0], temp_4, temp_5, temp_6, temp_7, temp_8, temp_9, temp_10, temp_11, temp_12);
280 wasm_madd(left[5], &right[0], temp_5, temp_6, temp_7, temp_8, temp_9, temp_10, temp_11, temp_12, temp_13);
281 wasm_madd(left[6], &right[0], temp_6, temp_7, temp_8, temp_9, temp_10, temp_11, temp_12, temp_13, temp_14);
282 wasm_madd(left[7], &right[0], temp_7, temp_8, temp_9, temp_10, temp_11, temp_12, temp_13, temp_14, temp_15);
283 wasm_madd(left[8], &right[0], temp_8, temp_9, temp_10, temp_11, temp_12, temp_13, temp_14, temp_15, temp_16);
320 return { { (temp_0 << 0) | (temp_1 << 29) | (temp_2 << 58),
321 (temp_2 >> 6) | (temp_3 << 23) | (temp_4 << 52),
322 (temp_4 >> 12) | (temp_5 << 17) | (temp_6 << 46),
323 (temp_6 >> 18) | (temp_7 << 11) | (temp_8 << 40) },
324 { (temp_8 >> 24) | (temp_9 << 5) | (temp_10 << 34) | (temp_11 << 63),
325 (temp_11 >> 1) | (temp_12 << 28) | (temp_13 << 57),
326 (temp_13 >> 7) | (temp_14 << 22) | (temp_15 << 51),
327 (temp_15 >> 13) | (temp_16 << 16) } };
412#if defined(__SIZEOF_INT128__) && !defined(__wasm__)
413 const auto [r0, t0] =
mac(0,
data[0], other.
data[0], 0ULL);
414 const auto [q0, t1] =
mac(0,
data[0], other.
data[1], t0);
415 const auto [q1, t2] =
mac(0,
data[0], other.
data[2], t1);
418 const auto [r1, t3] =
mac(q0,
data[1], other.
data[0], 0ULL);
419 const auto [q3, t4] =
mac(q1,
data[1], other.
data[1], t3);
422 const auto [r2, t5] =
mac(q3,
data[2], other.
data[0], 0ULL);
427 return { r0, r1, r2, r3 };
443 wasm_madd(left[0], &right[0], temp_0, temp_1, temp_2, temp_3, temp_4, temp_5, temp_6, temp_7, temp_8);
445 temp_1 += left[1] * right[0];
446 temp_2 += left[1] * right[1];
447 temp_3 += left[1] * right[2];
448 temp_4 += left[1] * right[3];
449 temp_5 += left[1] * right[4];
450 temp_6 += left[1] * right[5];
451 temp_7 += left[1] * right[6];
452 temp_8 += left[1] * right[7];
454 temp_2 += left[2] * right[0];
455 temp_3 += left[2] * right[1];
456 temp_4 += left[2] * right[2];
457 temp_5 += left[2] * right[3];
458 temp_6 += left[2] * right[4];
459 temp_7 += left[2] * right[5];
460 temp_8 += left[2] * right[6];
461 temp_3 += left[3] * right[0];
462 temp_4 += left[3] * right[1];
463 temp_5 += left[3] * right[2];
464 temp_6 += left[3] * right[3];
465 temp_7 += left[3] * right[4];
466 temp_8 += left[3] * right[5];
467 temp_4 += left[4] * right[0];
468 temp_5 += left[4] * right[1];
469 temp_6 += left[4] * right[2];
470 temp_7 += left[4] * right[3];
471 temp_8 += left[4] * right[4];
472 temp_5 += left[5] * right[0];
473 temp_6 += left[5] * right[1];
474 temp_7 += left[5] * right[2];
475 temp_8 += left[5] * right[3];
476 temp_6 += left[6] * right[0];
477 temp_7 += left[6] * right[1];
478 temp_8 += left[6] * right[2];
479 temp_7 += left[7] * right[0];
480 temp_8 += left[7] * right[1];
481 temp_8 += left[8] * right[0];
484 constexpr uint64_t mask = 0x1fffffff;
503 return { (temp_0 << 0) | (temp_1 << 29) | (temp_2 << 58),
504 (temp_2 >> 6) | (temp_3 << 23) | (temp_4 << 52),
505 (temp_4 >> 12) | (temp_5 << 17) | (temp_6 << 46),
506 (temp_6 >> 18) | (temp_7 << 11) | (temp_8 << 40) };
582 uint64_t total_shift = other.
data[0];
584 if (total_shift >= 256 || (other.
data[1] != 0U) || (other.
data[2] != 0U) || (other.
data[3] != 0U)) {
588 if (total_shift == 0) {
592 uint64_t num_shifted_limbs = total_shift >> 6ULL;
593 uint64_t limb_shift = total_shift & 63ULL;
597 if (limb_shift == 0) {
598 shifted_limbs[0] =
data[0];
599 shifted_limbs[1] =
data[1];
600 shifted_limbs[2] =
data[2];
601 shifted_limbs[3] =
data[3];
603 uint64_t remainder_shift = 64ULL - limb_shift;
605 shifted_limbs[3] =
data[3] >> limb_shift;
607 uint64_t remainder = (
data[3]) << remainder_shift;
609 shifted_limbs[2] = (
data[2] >> limb_shift) + remainder;
611 remainder = (
data[2]) << remainder_shift;
613 shifted_limbs[1] = (
data[1] >> limb_shift) + remainder;
615 remainder = (
data[1]) << remainder_shift;
617 shifted_limbs[0] = (
data[0] >> limb_shift) + remainder;
621 for (
size_t i = 0; i < 4 - num_shifted_limbs; ++i) {
622 result.
data[i] = shifted_limbs[
static_cast<size_t>(i + num_shifted_limbs)];
630 uint64_t total_shift = other.
data[0];
632 if (total_shift >= 256 || (other.
data[1] != 0U) || (other.
data[2] != 0U) || (other.
data[3] != 0U)) {
636 if (total_shift == 0) {
639 uint64_t num_shifted_limbs = total_shift >> 6ULL;
640 uint64_t limb_shift = total_shift & 63ULL;
644 if (limb_shift == 0) {
645 shifted_limbs[0] =
data[0];
646 shifted_limbs[1] =
data[1];
647 shifted_limbs[2] =
data[2];
648 shifted_limbs[3] =
data[3];
650 uint64_t remainder_shift = 64ULL - limb_shift;
652 shifted_limbs[0] =
data[0] << limb_shift;
654 uint64_t remainder =
data[0] >> remainder_shift;
656 shifted_limbs[1] = (
data[1] << limb_shift) + remainder;
658 remainder =
data[1] >> remainder_shift;
660 shifted_limbs[2] = (
data[2] << limb_shift) + remainder;
662 remainder =
data[2] >> remainder_shift;
664 shifted_limbs[3] = (
data[3] << limb_shift) + remainder;
668 for (
size_t i = 0; i < 4 - num_shifted_limbs; ++i) {
669 result.
data[
static_cast<size_t>(i + num_shifted_limbs)] = shifted_limbs[i];
static constexpr void wasm_madd(const uint64_t &left_limb, const uint64_t *right_limbs, uint64_t &result_0, uint64_t &result_1, uint64_t &result_2, uint64_t &result_3, uint64_t &result_4, uint64_t &result_5, uint64_t &result_6, uint64_t &result_7, uint64_t &result_8)
Multiply one limb by 9 limbs and add to resulting limbs.