@@ -160,22 +160,16 @@ constexpr type_t shr2(type_t value_hi, type_t value_lo, uint_t shift) noexcept;
160
160
161
161
template <typename type_t , std::enable_if_t <is_unsigned_v<type_t >, int > = 0 >
162
162
constexpr type_t addc (type_t value1, type_t value2, bool & carry) noexcept ;
163
- template <typename type_t , std::enable_if_t <is_unsigned_array_v<type_t >, int > = 0 >
164
- constexpr void add (type_t & value1, const type_t & value2) noexcept ;
165
163
166
164
// subtract with borrow
167
165
168
166
template <typename type_t , std::enable_if_t <is_unsigned_v<type_t >, int > = 0 >
169
167
constexpr type_t subb (type_t value1, type_t value2, bool & borrow) noexcept ;
170
- template <typename type_t , std::enable_if_t <is_unsigned_array_v<type_t >, int > = 0 >
171
- constexpr void sub (type_t & value1, const type_t & value2) noexcept ;
172
168
173
169
// multiply with carry
174
170
175
171
template <typename type_t , std::enable_if_t <is_unsigned_v<type_t >, int > = 0 >
176
172
constexpr type_t mulc (type_t value1, type_t value2, type_t & carry) noexcept ;
177
- template <typename type_t , std::enable_if_t <is_unsigned_array_v<type_t >, int > = 0 >
178
- constexpr void mul (type_t & value1, const type_t & value2) noexcept ;
179
173
180
174
// divide with remainder
181
175
@@ -311,18 +305,6 @@ constexpr type_t addc(type_t value1, const type_t value2, bool& carry) noexcept
311
305
312
306
313
307
314
- // //////////////////////////////////////////////////////////////////////////////////////////////////
315
- template <typename type_t , std::enable_if_t <is_unsigned_array_v<type_t >, int >>
316
- constexpr void add (type_t & value1, const type_t & value2) noexcept
317
- {
318
- bool carry = false ;
319
-
320
- for (uint_t n = 0 ; n < std::size (value1); ++n)
321
- value1[n] = addc (value1[n], value2[n], carry);
322
- }
323
-
324
-
325
-
326
308
// //////////////////////////////////////////////////////////////////////////////////////////////////
327
309
template <typename type_t , std::enable_if_t <is_unsigned_v<type_t >, int >>
328
310
constexpr type_t subb (type_t value1, type_t value2, bool & borrow) noexcept
@@ -342,18 +324,6 @@ constexpr type_t subb(type_t value1, type_t value2, bool& borrow) noexcept
342
324
343
325
344
326
345
- // //////////////////////////////////////////////////////////////////////////////////////////////////
346
- template <typename type_t , std::enable_if_t <is_unsigned_array_v<type_t >, int >>
347
- constexpr void sub (type_t & value1, const type_t & value2) noexcept
348
- {
349
- bool borrow = false ;
350
-
351
- for (uint_t n = 0 ; n < std::size (value1); ++n)
352
- value1[n] = subb (value1[n], value2[n], borrow);
353
- }
354
-
355
-
356
-
357
327
// //////////////////////////////////////////////////////////////////////////////////////////////////
358
328
template <typename type_t , std::enable_if_t <is_unsigned_v<type_t >, int > = 0 >
359
329
constexpr type_t mulc_classic (type_t value1, type_t value2, type_t & carry) noexcept
@@ -457,37 +427,6 @@ constexpr type_t mulc(type_t value1, type_t value2, type_t& carry) noexcept
457
427
458
428
459
429
460
- // //////////////////////////////////////////////////////////////////////////////////////////////////
461
- template <typename type_t , std::enable_if_t <is_unsigned_array_v<type_t >, int >>
462
- constexpr void mul (type_t & value1, const type_t & value2) noexcept
463
- {
464
- using value_t = typename type_t ::value_type;
465
- value_t carry = 0 ;
466
-
467
- type_t result;
468
- result[0 ] = mulc (value1[0 ], value2[0 ], carry);
469
-
470
- for (uint_t n = 1 ; n < std::size (value1); ++n)
471
- result[n] = mulc (value1[n], value2[0 ], carry);
472
-
473
- for (uint_t n = 1 ; n < std::size (value1); ++n) {
474
-
475
- type_t tmp;
476
- carry = 0 ;
477
-
478
- for (uint_t k = 0 ; k < n; ++k)
479
- tmp[k] = 0 ;
480
- for (uint_t k = 0 ; k < std::size (value1) - n; ++k)
481
- tmp[k + n] = mulc (value1[k], value2[n], carry);
482
-
483
- add (result, tmp);
484
- }
485
-
486
- value1 = result;
487
- }
488
-
489
-
490
-
491
430
// //////////////////////////////////////////////////////////////////////////////////////////////////
492
431
template <typename type_t , std::enable_if_t <is_unsigned_v<type_t >, int >>
493
432
constexpr type_t divr (type_t value1, type_t value2, std::optional<type_t >& remainder) noexcept
0 commit comments