Skip to content

Commit

Permalink
Remove UB from thread-id relational operators
Browse files Browse the repository at this point in the history
  • Loading branch information
K-ballo committed Jan 17, 2018
1 parent 26fa6ed commit a01a742
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions hpx/runtime/threads/thread.hpp
Expand Up @@ -16,6 +16,7 @@
#include <hpx/util_fwd.hpp>

#include <cstddef>
#include <functional>
#include <iosfwd>
#include <mutex>
#include <utility>
Expand Down Expand Up @@ -149,7 +150,7 @@ namespace hpx

inline bool operator== (thread::id const& x, thread::id const& y) noexcept
{
return x.id_.get() == y.id_.get();
return x.id_ == y.id_;
}

inline bool operator!= (thread::id const& x, thread::id const& y) noexcept
Expand All @@ -159,22 +160,22 @@ namespace hpx

inline bool operator< (thread::id const& x, thread::id const& y) noexcept
{
return x.id_.get() < y.id_.get();
return x.id_ < y.id_;
}

inline bool operator> (thread::id const& x, thread::id const& y) noexcept
{
return x.id_.get() > y.id_.get();
return y < x;
}

inline bool operator<= (thread::id const& x, thread::id const& y) noexcept
{
return !(x.id_.get() > y.id_.get());
return !(x > y);
}

inline bool operator>= (thread::id const& x, thread::id const& y) noexcept
{
return !(x.id_.get() < y.id_.get());
return !(x < y);
}

template <typename Char, typename Traits>
Expand Down

0 comments on commit a01a742

Please sign in to comment.