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];
215#if defined(__SIZEOF_INT128__) && !defined(__wasm__)
217 const auto [q0, t1] =
mac(t0,
data[0], other.
data[1], 0);
218 const auto [q1, t2] =
mac(t1,
data[0], other.
data[2], 0);
219 const auto [q2, z0] =
mac(t2,
data[0], other.
data[3], 0);
221 const auto [r1, t3] =
mac(q0,
data[1], other.
data[0], 0);
222 const auto [q3, t4] =
mac(q1,
data[1], other.
data[1], t3);
223 const auto [q4, t5] =
mac(q2,
data[1], other.
data[2], t4);
224 const auto [q5, z1] =
mac(z0,
data[1], other.
data[3], t5);
226 const auto [r2, t6] =
mac(q3,
data[2], other.
data[0], 0);
227 const auto [q6, t7] =
mac(q4,
data[2], other.
data[1], t6);
228 const auto [q7, t8] =
mac(q5,
data[2], other.
data[2], t7);
229 const auto [q8, z2] =
mac(z1,
data[2], other.
data[3], t8);
231 const auto [r3, t9] =
mac(q6,
data[3], other.
data[0], 0);
232 const auto [r4, t10] =
mac(q7,
data[3], other.
data[1], t9);
233 const auto [r5, t11] =
mac(q8,
data[3], other.
data[2], t10);
234 const auto [r6, r7] =
mac(z2,
data[3], other.
data[3], t11);
243 constexpr uint64_t mask = 0x1fffffff;
254 uint64_t temp_10 = 0;
255 uint64_t temp_11 = 0;
256 uint64_t temp_12 = 0;
257 uint64_t temp_13 = 0;
258 uint64_t temp_14 = 0;
259 uint64_t temp_15 = 0;
260 uint64_t temp_16 = 0;
263 wasm_madd(left[0], &right[0], temp_0, temp_1, temp_2, temp_3, temp_4, temp_5, temp_6, temp_7, temp_8);
264 wasm_madd(left[1], &right[0], temp_1, temp_2, temp_3, temp_4, temp_5, temp_6, temp_7, temp_8, temp_9);
265 wasm_madd(left[2], &right[0], temp_2, temp_3, temp_4, temp_5, temp_6, temp_7, temp_8, temp_9, temp_10);
266 wasm_madd(left[3], &right[0], temp_3, temp_4, temp_5, temp_6, temp_7, temp_8, temp_9, temp_10, temp_11);
267 wasm_madd(left[4], &right[0], temp_4, temp_5, temp_6, temp_7, temp_8, temp_9, temp_10, temp_11, temp_12);
268 wasm_madd(left[5], &right[0], temp_5, temp_6, temp_7, temp_8, temp_9, temp_10, temp_11, temp_12, temp_13);
269 wasm_madd(left[6], &right[0], temp_6, temp_7, temp_8, temp_9, temp_10, temp_11, temp_12, temp_13, temp_14);
270 wasm_madd(left[7], &right[0], temp_7, temp_8, temp_9, temp_10, temp_11, temp_12, temp_13, temp_14, temp_15);
271 wasm_madd(left[8], &right[0], temp_8, temp_9, temp_10, temp_11, temp_12, temp_13, temp_14, temp_15, temp_16);
308 return { { (temp_0 << 0) | (temp_1 << 29) | (temp_2 << 58),
309 (temp_2 >> 6) | (temp_3 << 23) | (temp_4 << 52),
310 (temp_4 >> 12) | (temp_5 << 17) | (temp_6 << 46),
311 (temp_6 >> 18) | (temp_7 << 11) | (temp_8 << 40) },
312 { (temp_8 >> 24) | (temp_9 << 5) | (temp_10 << 34) | (temp_11 << 63),
313 (temp_11 >> 1) | (temp_12 << 28) | (temp_13 << 57),
314 (temp_13 >> 7) | (temp_14 << 22) | (temp_15 << 51),
315 (temp_15 >> 13) | (temp_16 << 16) } };
398#if defined(__SIZEOF_INT128__) && !defined(__wasm__)
399 const auto [r0, t0] =
mac(0,
data[0], other.
data[0], 0ULL);
400 const auto [q0, t1] =
mac(0,
data[0], other.
data[1], t0);
401 const auto [q1, t2] =
mac(0,
data[0], other.
data[2], t1);
404 const auto [r1, t3] =
mac(q0,
data[1], other.
data[0], 0ULL);
405 const auto [q3, t4] =
mac(q1,
data[1], other.
data[1], t3);
408 const auto [r2, t5] =
mac(q3,
data[2], other.
data[0], 0ULL);
413 return { r0, r1, r2, r3 };
429 wasm_madd(left[0], &right[0], temp_0, temp_1, temp_2, temp_3, temp_4, temp_5, temp_6, temp_7, temp_8);
431 temp_1 += left[1] * right[0];
432 temp_2 += left[1] * right[1];
433 temp_3 += left[1] * right[2];
434 temp_4 += left[1] * right[3];
435 temp_5 += left[1] * right[4];
436 temp_6 += left[1] * right[5];
437 temp_7 += left[1] * right[6];
438 temp_8 += left[1] * right[7];
440 temp_2 += left[2] * right[0];
441 temp_3 += left[2] * right[1];
442 temp_4 += left[2] * right[2];
443 temp_5 += left[2] * right[3];
444 temp_6 += left[2] * right[4];
445 temp_7 += left[2] * right[5];
446 temp_8 += left[2] * right[6];
447 temp_3 += left[3] * right[0];
448 temp_4 += left[3] * right[1];
449 temp_5 += left[3] * right[2];
450 temp_6 += left[3] * right[3];
451 temp_7 += left[3] * right[4];
452 temp_8 += left[3] * right[5];
453 temp_4 += left[4] * right[0];
454 temp_5 += left[4] * right[1];
455 temp_6 += left[4] * right[2];
456 temp_7 += left[4] * right[3];
457 temp_8 += left[4] * right[4];
458 temp_5 += left[5] * right[0];
459 temp_6 += left[5] * right[1];
460 temp_7 += left[5] * right[2];
461 temp_8 += left[5] * right[3];
462 temp_6 += left[6] * right[0];
463 temp_7 += left[6] * right[1];
464 temp_8 += left[6] * right[2];
465 temp_7 += left[7] * right[0];
466 temp_8 += left[7] * right[1];
467 temp_8 += left[8] * right[0];
470 constexpr uint64_t mask = 0x1fffffff;
489 return { (temp_0 << 0) | (temp_1 << 29) | (temp_2 << 58),
490 (temp_2 >> 6) | (temp_3 << 23) | (temp_4 << 52),
491 (temp_4 >> 12) | (temp_5 << 17) | (temp_6 << 46),
492 (temp_6 >> 18) | (temp_7 << 11) | (temp_8 << 40) };
568 uint64_t total_shift = other.
data[0];
570 if (total_shift >= 256 || (other.
data[1] != 0U) || (other.
data[2] != 0U) || (other.
data[3] != 0U)) {
574 if (total_shift == 0) {
578 uint64_t num_shifted_limbs = total_shift >> 6ULL;
579 uint64_t limb_shift = total_shift & 63ULL;
583 if (limb_shift == 0) {
584 shifted_limbs[0] =
data[0];
585 shifted_limbs[1] =
data[1];
586 shifted_limbs[2] =
data[2];
587 shifted_limbs[3] =
data[3];
589 uint64_t remainder_shift = 64ULL - limb_shift;
591 shifted_limbs[3] =
data[3] >> limb_shift;
593 uint64_t remainder = (
data[3]) << remainder_shift;
595 shifted_limbs[2] = (
data[2] >> limb_shift) + remainder;
597 remainder = (
data[2]) << remainder_shift;
599 shifted_limbs[1] = (
data[1] >> limb_shift) + remainder;
601 remainder = (
data[1]) << remainder_shift;
603 shifted_limbs[0] = (
data[0] >> limb_shift) + remainder;
607 for (
size_t i = 0; i < 4 - num_shifted_limbs; ++i) {
608 result.
data[i] = shifted_limbs[
static_cast<size_t>(i + num_shifted_limbs)];
616 uint64_t total_shift = other.
data[0];
618 if (total_shift >= 256 || (other.
data[1] != 0U) || (other.
data[2] != 0U) || (other.
data[3] != 0U)) {
622 if (total_shift == 0) {
625 uint64_t num_shifted_limbs = total_shift >> 6ULL;
626 uint64_t limb_shift = total_shift & 63ULL;
630 if (limb_shift == 0) {
631 shifted_limbs[0] =
data[0];
632 shifted_limbs[1] =
data[1];
633 shifted_limbs[2] =
data[2];
634 shifted_limbs[3] =
data[3];
636 uint64_t remainder_shift = 64ULL - limb_shift;
638 shifted_limbs[0] =
data[0] << limb_shift;
640 uint64_t remainder =
data[0] >> remainder_shift;
642 shifted_limbs[1] = (
data[1] << limb_shift) + remainder;
644 remainder =
data[1] >> remainder_shift;
646 shifted_limbs[2] = (
data[2] << limb_shift) + remainder;
648 remainder =
data[2] >> remainder_shift;
650 shifted_limbs[3] = (
data[3] << limb_shift) + remainder;
654 for (
size_t i = 0; i < 4 - num_shifted_limbs; ++i) {
655 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.