Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit c540dab

Browse files
committed
Implementation of no-carry montgomery multiplication.
1 parent 93edae7 commit c540dab

File tree

4 files changed

+272
-23
lines changed

4 files changed

+272
-23
lines changed

libs/multiprecision/include/nil/crypto3/multiprecision/cpp_int_modular/bitwise.hpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,15 @@ namespace boost {
9999

100100
template<unsigned Bits>
101101
BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
102-
boost::multiprecision::is_unsigned_number<cpp_int_modular_backend<Bits>>::value &&
103-
!boost::multiprecision::backends::is_trivial_cpp_int_modular<cpp_int_modular_backend<Bits>>::value &&
104-
!boost::multiprecision::backends::is_trivial_cpp_int_modular<cpp_int_modular_backend<Bits>>::value>::
105-
type
102+
!boost::multiprecision::backends::is_trivial_cpp_int_modular<cpp_int_modular_backend<Bits>>::value>::type
106103
eval_complement(cpp_int_modular_backend<Bits>& result, const cpp_int_modular_backend<Bits>& o) noexcept {
107104

108105
unsigned os = o.size();
109106
for (unsigned i = 0; i < os; ++i)
110107
result.limbs()[i] = ~o.limbs()[i];
111108
result.normalize();
112109
}
113-
#ifndef TVM
110+
114111
// Left shift will throw away upper bits.
115112
// This function must be called only when s % 8 == 0, i.e. we shift bytes.
116113
template<unsigned Bits>
@@ -129,7 +126,6 @@ namespace boost {
129126
std::memset(pc, 0, bytes);
130127
}
131128
}
132-
#endif
133129

134130
// Left shift will throw away upper bits.
135131
// This function must be called only when s % limb_bits == 0, i.e. we shift limbs, which are normally 64 bit.

0 commit comments

Comments
 (0)