Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 6 additions & 15 deletions include/intx/intx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1211,24 +1211,15 @@ inline constexpr bool operator!=(const T& x, const uint<N>& y) noexcept
return uint<N>(x) != y;
}

#if !defined(_MSC_VER) || _MSC_VER < 1916 // This kills MSVC 2017 compiler.
inline constexpr bool operator<(const uint256& x, const uint256& y) noexcept
{
auto xp = uint128{x[2], x[3]};
auto yp = uint128{y[2], y[3]};
if (xp == yp)
{
xp = uint128{x[0], x[1]};
yp = uint128{y[0], y[1]};
}
return xp < yp;
}
#endif

template <unsigned N>
inline constexpr bool operator<(const uint<N>& x, const uint<N>& y) noexcept
{
return subc(x, y).carry;
for (auto i = uint<N>::num_words - 1; i > 0; --i)
{
if (x[i] != y[i])
return x[i] < y[i];
}
return x[0] < y[0];
}

template <unsigned N, typename T,
Expand Down