89 const uint64_t* right_limbs,
100 result_0 += left_limb * right_limbs[0];
101 result_1 += left_limb * right_limbs[1];
102 result_2 += left_limb * right_limbs[2];
103 result_3 += left_limb * right_limbs[3];
104 result_4 += left_limb * right_limbs[4];
105 result_5 += left_limb * right_limbs[5];
106 result_6 += left_limb * right_limbs[6];
107 result_7 += left_limb * right_limbs[7];
108 result_8 += left_limb * right_limbs[8];
182#if defined(__SIZEOF_INT128__) && !defined(__wasm__)
184 const auto [q0, t1] =
mac(t0,
data[0], other.
data[1], 0);
185 const auto [q1, t2] =
mac(t1,
data[0], other.
data[2], 0);
186 const auto [q2, z0] =
mac(t2,
data[0], other.
data[3], 0);
188 const auto [r1, t3] =
mac(q0,
data[1], other.
data[0], 0);
189 const auto [q3, t4] =
mac(q1,
data[1], other.
data[1], t3);
190 const auto [q4, t5] =
mac(q2,
data[1], other.
data[2], t4);
191 const auto [q5, z1] =
mac(z0,
data[1], other.
data[3], t5);
193 const auto [r2, t6] =
mac(q3,
data[2], other.
data[0], 0);
194 const auto [q6, t7] =
mac(q4,
data[2], other.
data[1], t6);
195 const auto [q7, t8] =
mac(q5,
data[2], other.
data[2], t7);
196 const auto [q8, z2] =
mac(z1,
data[2], other.
data[3], t8);
198 const auto [r3, t9] =
mac(q6,
data[3], other.
data[0], 0);
199 const auto [r4, t10] =
mac(q7,
data[3], other.
data[1], t9);
200 const auto [r5, t11] =
mac(q8,
data[3], other.
data[2], t10);
201 const auto [r6, r7] =
mac(z2,
data[3], other.
data[3], t11);
210 constexpr uint64_t mask = 0x1fffffff;
221 uint64_t temp_10 = 0;
222 uint64_t temp_11 = 0;
223 uint64_t temp_12 = 0;
224 uint64_t temp_13 = 0;
225 uint64_t temp_14 = 0;
226 uint64_t temp_15 = 0;
227 uint64_t temp_16 = 0;
230 wasm_madd(left[0], &right[0], temp_0, temp_1, temp_2, temp_3, temp_4, temp_5, temp_6, temp_7, temp_8);
231 wasm_madd(left[1], &right[0], temp_1, temp_2, temp_3, temp_4, temp_5, temp_6, temp_7, temp_8, temp_9);
232 wasm_madd(left[2], &right[0], temp_2, temp_3, temp_4, temp_5, temp_6, temp_7, temp_8, temp_9, temp_10);
233 wasm_madd(left[3], &right[0], temp_3, temp_4, temp_5, temp_6, temp_7, temp_8, temp_9, temp_10, temp_11);
234 wasm_madd(left[4], &right[0], temp_4, temp_5, temp_6, temp_7, temp_8, temp_9, temp_10, temp_11, temp_12);
235 wasm_madd(left[5], &right[0], temp_5, temp_6, temp_7, temp_8, temp_9, temp_10, temp_11, temp_12, temp_13);
236 wasm_madd(left[6], &right[0], temp_6, temp_7, temp_8, temp_9, temp_10, temp_11, temp_12, temp_13, temp_14);
237 wasm_madd(left[7], &right[0], temp_7, temp_8, temp_9, temp_10, temp_11, temp_12, temp_13, temp_14, temp_15);
238 wasm_madd(left[8], &right[0], temp_8, temp_9, temp_10, temp_11, temp_12, temp_13, temp_14, temp_15, temp_16);
275 return { { (temp_0 << 0) | (temp_1 << 29) | (temp_2 << 58),
276 (temp_2 >> 6) | (temp_3 << 23) | (temp_4 << 52),
277 (temp_4 >> 12) | (temp_5 << 17) | (temp_6 << 46),
278 (temp_6 >> 18) | (temp_7 << 11) | (temp_8 << 40) },
279 { (temp_8 >> 24) | (temp_9 << 5) | (temp_10 << 34) | (temp_11 << 63),
280 (temp_11 >> 1) | (temp_12 << 28) | (temp_13 << 57),
281 (temp_13 >> 7) | (temp_14 << 22) | (temp_15 << 51),
282 (temp_15 >> 13) | (temp_16 << 16) } };
365#if defined(__SIZEOF_INT128__) && !defined(__wasm__)
366 const auto [r0, t0] =
mac(0,
data[0], other.
data[0], 0ULL);
367 const auto [q0, t1] =
mac(0,
data[0], other.
data[1], t0);
368 const auto [q1, t2] =
mac(0,
data[0], other.
data[2], t1);
371 const auto [r1, t3] =
mac(q0,
data[1], other.
data[0], 0ULL);
372 const auto [q3, t4] =
mac(q1,
data[1], other.
data[1], t3);
375 const auto [r2, t5] =
mac(q3,
data[2], other.
data[0], 0ULL);
380 return { r0, r1, r2, r3 };
396 wasm_madd(left[0], &right[0], temp_0, temp_1, temp_2, temp_3, temp_4, temp_5, temp_6, temp_7, temp_8);
398 temp_1 += left[1] * right[0];
399 temp_2 += left[1] * right[1];
400 temp_3 += left[1] * right[2];
401 temp_4 += left[1] * right[3];
402 temp_5 += left[1] * right[4];
403 temp_6 += left[1] * right[5];
404 temp_7 += left[1] * right[6];
405 temp_8 += left[1] * right[7];
407 temp_2 += left[2] * right[0];
408 temp_3 += left[2] * right[1];
409 temp_4 += left[2] * right[2];
410 temp_5 += left[2] * right[3];
411 temp_6 += left[2] * right[4];
412 temp_7 += left[2] * right[5];
413 temp_8 += left[2] * right[6];
414 temp_3 += left[3] * right[0];
415 temp_4 += left[3] * right[1];
416 temp_5 += left[3] * right[2];
417 temp_6 += left[3] * right[3];
418 temp_7 += left[3] * right[4];
419 temp_8 += left[3] * right[5];
420 temp_4 += left[4] * right[0];
421 temp_5 += left[4] * right[1];
422 temp_6 += left[4] * right[2];
423 temp_7 += left[4] * right[3];
424 temp_8 += left[4] * right[4];
425 temp_5 += left[5] * right[0];
426 temp_6 += left[5] * right[1];
427 temp_7 += left[5] * right[2];
428 temp_8 += left[5] * right[3];
429 temp_6 += left[6] * right[0];
430 temp_7 += left[6] * right[1];
431 temp_8 += left[6] * right[2];
432 temp_7 += left[7] * right[0];
433 temp_8 += left[7] * right[1];
434 temp_8 += left[8] * right[0];
437 constexpr uint64_t mask = 0x1fffffff;
456 return { (temp_0 << 0) | (temp_1 << 29) | (temp_2 << 58),
457 (temp_2 >> 6) | (temp_3 << 23) | (temp_4 << 52),
458 (temp_4 >> 12) | (temp_5 << 17) | (temp_6 << 46),
459 (temp_6 >> 18) | (temp_7 << 11) | (temp_8 << 40) };
535 uint64_t total_shift = other.
data[0];
537 if (total_shift >= 256 || (other.
data[1] != 0U) || (other.
data[2] != 0U) || (other.
data[3] != 0U)) {
541 if (total_shift == 0) {
545 uint64_t num_shifted_limbs = total_shift >> 6ULL;
546 uint64_t limb_shift = total_shift & 63ULL;
550 if (limb_shift == 0) {
551 shifted_limbs[0] =
data[0];
552 shifted_limbs[1] =
data[1];
553 shifted_limbs[2] =
data[2];
554 shifted_limbs[3] =
data[3];
556 uint64_t remainder_shift = 64ULL - limb_shift;
558 shifted_limbs[3] =
data[3] >> limb_shift;
560 uint64_t remainder = (
data[3]) << remainder_shift;
562 shifted_limbs[2] = (
data[2] >> limb_shift) + remainder;
564 remainder = (
data[2]) << remainder_shift;
566 shifted_limbs[1] = (
data[1] >> limb_shift) + remainder;
568 remainder = (
data[1]) << remainder_shift;
570 shifted_limbs[0] = (
data[0] >> limb_shift) + remainder;
574 for (
size_t i = 0; i < 4 - num_shifted_limbs; ++i) {
575 result.
data[i] = shifted_limbs[
static_cast<size_t>(i + num_shifted_limbs)];
583 uint64_t total_shift = other.
data[0];
585 if (total_shift >= 256 || (other.
data[1] != 0U) || (other.
data[2] != 0U) || (other.
data[3] != 0U)) {
589 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[0] =
data[0] << limb_shift;
607 uint64_t remainder =
data[0] >> remainder_shift;
609 shifted_limbs[1] = (
data[1] << limb_shift) + remainder;
611 remainder =
data[1] >> remainder_shift;
613 shifted_limbs[2] = (
data[2] << limb_shift) + remainder;
615 remainder =
data[2] >> remainder_shift;
617 shifted_limbs[3] = (
data[3] << limb_shift) + remainder;
621 for (
size_t i = 0; i < 4 - num_shifted_limbs; ++i) {
622 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.