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];
221#if defined(__SIZEOF_INT128__) && !defined(__wasm__)
223 const auto [q0, t1] =
mac(t0,
data[0], other.
data[1], 0);
224 const auto [q1, t2] =
mac(t1,
data[0], other.
data[2], 0);
225 const auto [q2, z0] =
mac(t2,
data[0], other.
data[3], 0);
227 const auto [r1, t3] =
mac(q0,
data[1], other.
data[0], 0);
228 const auto [q3, t4] =
mac(q1,
data[1], other.
data[1], t3);
229 const auto [q4, t5] =
mac(q2,
data[1], other.
data[2], t4);
230 const auto [q5, z1] =
mac(z0,
data[1], other.
data[3], t5);
232 const auto [r2, t6] =
mac(q3,
data[2], other.
data[0], 0);
233 const auto [q6, t7] =
mac(q4,
data[2], other.
data[1], t6);
234 const auto [q7, t8] =
mac(q5,
data[2], other.
data[2], t7);
235 const auto [q8, z2] =
mac(z1,
data[2], other.
data[3], t8);
237 const auto [r3, t9] =
mac(q6,
data[3], other.
data[0], 0);
238 const auto [r4, t10] =
mac(q7,
data[3], other.
data[1], t9);
239 const auto [r5, t11] =
mac(q8,
data[3], other.
data[2], t10);
240 const auto [r6, r7] =
mac(z2,
data[3], other.
data[3], t11);
249 constexpr uint64_t mask = 0x1fffffff;
260 uint64_t temp_10 = 0;
261 uint64_t temp_11 = 0;
262 uint64_t temp_12 = 0;
263 uint64_t temp_13 = 0;
264 uint64_t temp_14 = 0;
265 uint64_t temp_15 = 0;
266 uint64_t temp_16 = 0;
269 wasm_madd(left[0], &right[0], temp_0, temp_1, temp_2, temp_3, temp_4, temp_5, temp_6, temp_7, temp_8);
270 wasm_madd(left[1], &right[0], temp_1, temp_2, temp_3, temp_4, temp_5, temp_6, temp_7, temp_8, temp_9);
271 wasm_madd(left[2], &right[0], temp_2, temp_3, temp_4, temp_5, temp_6, temp_7, temp_8, temp_9, temp_10);
272 wasm_madd(left[3], &right[0], temp_3, temp_4, temp_5, temp_6, temp_7, temp_8, temp_9, temp_10, temp_11);
273 wasm_madd(left[4], &right[0], temp_4, temp_5, temp_6, temp_7, temp_8, temp_9, temp_10, temp_11, temp_12);
274 wasm_madd(left[5], &right[0], temp_5, temp_6, temp_7, temp_8, temp_9, temp_10, temp_11, temp_12, temp_13);
275 wasm_madd(left[6], &right[0], temp_6, temp_7, temp_8, temp_9, temp_10, temp_11, temp_12, temp_13, temp_14);
276 wasm_madd(left[7], &right[0], temp_7, temp_8, temp_9, temp_10, temp_11, temp_12, temp_13, temp_14, temp_15);
277 wasm_madd(left[8], &right[0], temp_8, temp_9, temp_10, temp_11, temp_12, temp_13, temp_14, temp_15, temp_16);
314 return { { (temp_0 << 0) | (temp_1 << 29) | (temp_2 << 58),
315 (temp_2 >> 6) | (temp_3 << 23) | (temp_4 << 52),
316 (temp_4 >> 12) | (temp_5 << 17) | (temp_6 << 46),
317 (temp_6 >> 18) | (temp_7 << 11) | (temp_8 << 40) },
318 { (temp_8 >> 24) | (temp_9 << 5) | (temp_10 << 34) | (temp_11 << 63),
319 (temp_11 >> 1) | (temp_12 << 28) | (temp_13 << 57),
320 (temp_13 >> 7) | (temp_14 << 22) | (temp_15 << 51),
321 (temp_15 >> 13) | (temp_16 << 16) } };
404#if defined(__SIZEOF_INT128__) && !defined(__wasm__)
405 const auto [r0, t0] =
mac(0,
data[0], other.
data[0], 0ULL);
406 const auto [q0, t1] =
mac(0,
data[0], other.
data[1], t0);
407 const auto [q1, t2] =
mac(0,
data[0], other.
data[2], t1);
410 const auto [r1, t3] =
mac(q0,
data[1], other.
data[0], 0ULL);
411 const auto [q3, t4] =
mac(q1,
data[1], other.
data[1], t3);
414 const auto [r2, t5] =
mac(q3,
data[2], other.
data[0], 0ULL);
419 return { r0, r1, r2, r3 };
435 wasm_madd(left[0], &right[0], temp_0, temp_1, temp_2, temp_3, temp_4, temp_5, temp_6, temp_7, temp_8);
437 temp_1 += left[1] * right[0];
438 temp_2 += left[1] * right[1];
439 temp_3 += left[1] * right[2];
440 temp_4 += left[1] * right[3];
441 temp_5 += left[1] * right[4];
442 temp_6 += left[1] * right[5];
443 temp_7 += left[1] * right[6];
444 temp_8 += left[1] * right[7];
446 temp_2 += left[2] * right[0];
447 temp_3 += left[2] * right[1];
448 temp_4 += left[2] * right[2];
449 temp_5 += left[2] * right[3];
450 temp_6 += left[2] * right[4];
451 temp_7 += left[2] * right[5];
452 temp_8 += left[2] * right[6];
453 temp_3 += left[3] * right[0];
454 temp_4 += left[3] * right[1];
455 temp_5 += left[3] * right[2];
456 temp_6 += left[3] * right[3];
457 temp_7 += left[3] * right[4];
458 temp_8 += left[3] * right[5];
459 temp_4 += left[4] * right[0];
460 temp_5 += left[4] * right[1];
461 temp_6 += left[4] * right[2];
462 temp_7 += left[4] * right[3];
463 temp_8 += left[4] * right[4];
464 temp_5 += left[5] * right[0];
465 temp_6 += left[5] * right[1];
466 temp_7 += left[5] * right[2];
467 temp_8 += left[5] * right[3];
468 temp_6 += left[6] * right[0];
469 temp_7 += left[6] * right[1];
470 temp_8 += left[6] * right[2];
471 temp_7 += left[7] * right[0];
472 temp_8 += left[7] * right[1];
473 temp_8 += left[8] * right[0];
476 constexpr uint64_t mask = 0x1fffffff;
495 return { (temp_0 << 0) | (temp_1 << 29) | (temp_2 << 58),
496 (temp_2 >> 6) | (temp_3 << 23) | (temp_4 << 52),
497 (temp_4 >> 12) | (temp_5 << 17) | (temp_6 << 46),
498 (temp_6 >> 18) | (temp_7 << 11) | (temp_8 << 40) };
574 uint64_t total_shift = other.
data[0];
576 if (total_shift >= 256 || (other.
data[1] != 0U) || (other.
data[2] != 0U) || (other.
data[3] != 0U)) {
580 if (total_shift == 0) {
584 uint64_t num_shifted_limbs = total_shift >> 6ULL;
585 uint64_t limb_shift = total_shift & 63ULL;
589 if (limb_shift == 0) {
590 shifted_limbs[0] =
data[0];
591 shifted_limbs[1] =
data[1];
592 shifted_limbs[2] =
data[2];
593 shifted_limbs[3] =
data[3];
595 uint64_t remainder_shift = 64ULL - limb_shift;
597 shifted_limbs[3] =
data[3] >> limb_shift;
599 uint64_t remainder = (
data[3]) << remainder_shift;
601 shifted_limbs[2] = (
data[2] >> limb_shift) + remainder;
603 remainder = (
data[2]) << remainder_shift;
605 shifted_limbs[1] = (
data[1] >> limb_shift) + remainder;
607 remainder = (
data[1]) << remainder_shift;
609 shifted_limbs[0] = (
data[0] >> limb_shift) + remainder;
613 for (
size_t i = 0; i < 4 - num_shifted_limbs; ++i) {
614 result.
data[i] = shifted_limbs[
static_cast<size_t>(i + num_shifted_limbs)];
622 uint64_t total_shift = other.
data[0];
624 if (total_shift >= 256 || (other.
data[1] != 0U) || (other.
data[2] != 0U) || (other.
data[3] != 0U)) {
628 if (total_shift == 0) {
631 uint64_t num_shifted_limbs = total_shift >> 6ULL;
632 uint64_t limb_shift = total_shift & 63ULL;
636 if (limb_shift == 0) {
637 shifted_limbs[0] =
data[0];
638 shifted_limbs[1] =
data[1];
639 shifted_limbs[2] =
data[2];
640 shifted_limbs[3] =
data[3];
642 uint64_t remainder_shift = 64ULL - limb_shift;
644 shifted_limbs[0] =
data[0] << limb_shift;
646 uint64_t remainder =
data[0] >> remainder_shift;
648 shifted_limbs[1] = (
data[1] << limb_shift) + remainder;
650 remainder =
data[1] >> remainder_shift;
652 shifted_limbs[2] = (
data[2] << limb_shift) + remainder;
654 remainder =
data[2] >> remainder_shift;
656 shifted_limbs[3] = (
data[3] << limb_shift) + remainder;
660 for (
size_t i = 0; i < 4 - num_shifted_limbs; ++i) {
661 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.