Skip to content

Commit 4004a04

Browse files
committed
update only comparison
1 parent 58c0c7f commit 4004a04

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

include/intx/intx.hpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,7 @@ inline constexpr bool operator!=(const T& x, const uint<N>& y) noexcept
11201120
return uint<N>(x) != y;
11211121
}
11221122

1123-
#if !defined(_MSC_VER) || _MSC_VER < 1916 // This kills MSVC 2017 compiler.
1123+
#if 0 && (!defined(_MSC_VER) || _MSC_VER < 1916) // This kills MSVC 2017 compiler.
11241124
inline constexpr bool operator<(const uint256& x, const uint256& y) noexcept
11251125
{
11261126
auto xp = uint128{x[2], x[3]};
@@ -1137,7 +1137,11 @@ inline constexpr bool operator<(const uint256& x, const uint256& y) noexcept
11371137
template <unsigned N>
11381138
inline constexpr bool operator<(const uint<N>& x, const uint<N>& y) noexcept
11391139
{
1140-
return subc(x, y).carry;
1140+
for (size_t i = uint<N>::num_words; i-- > 1; ) {
1141+
if (x[i] != y[i])
1142+
return x[i] < y[i];
1143+
}
1144+
return x[0] < y[0];
11411145
}
11421146

11431147
template <unsigned N, typename T,

0 commit comments

Comments
 (0)