@@ -160,22 +160,16 @@ constexpr type_t shr2(type_t value_hi, type_t value_lo, uint_t shift) noexcept;
160160
161161template <typename type_t , std::enable_if_t <is_unsigned_v<type_t >, int > = 0 >
162162constexpr 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 ;
165163
166164// subtract with borrow
167165
168166template <typename type_t , std::enable_if_t <is_unsigned_v<type_t >, int > = 0 >
169167constexpr 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 ;
172168
173169// multiply with carry
174170
175171template <typename type_t , std::enable_if_t <is_unsigned_v<type_t >, int > = 0 >
176172constexpr 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 ;
179173
180174// divide with remainder
181175
@@ -311,18 +305,6 @@ constexpr type_t addc(type_t value1, const type_t value2, bool& carry) noexcept
311305
312306
313307
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-
326308// //////////////////////////////////////////////////////////////////////////////////////////////////
327309template <typename type_t , std::enable_if_t <is_unsigned_v<type_t >, int >>
328310constexpr 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
342324
343325
344326
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-
357327// //////////////////////////////////////////////////////////////////////////////////////////////////
358328template <typename type_t , std::enable_if_t <is_unsigned_v<type_t >, int > = 0 >
359329constexpr 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
457427
458428
459429
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-
491430// //////////////////////////////////////////////////////////////////////////////////////////////////
492431template <typename type_t , std::enable_if_t <is_unsigned_v<type_t >, int >>
493432constexpr type_t divr (type_t value1, type_t value2, std::optional<type_t >& remainder) noexcept
0 commit comments