Skip to content

Commit

Permalink
Add more explicit comparison operators for clang
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacquwes committed Sep 27, 2023
1 parent e787517 commit 4525611
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions shared/include/snowflake.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ namespace pine
bool operator ==(snowflake const& other) const;

/// @brief Compare a snowflake with an id.
bool operator !=(uint64_t const& other) const;
bool operator !=(uint64_t other) const;

/// @brief Compare a snowflake with an id.
bool operator ==(uint64_t const& other) const;
bool operator ==(uint64_t other) const;

/// @brief Convert the snowflake to an id.
constexpr operator uint64_t() const
Expand Down
6 changes: 3 additions & 3 deletions shared/src/snowflake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ namespace pine
&& value.sequence == other.value.sequence;
}

bool snowflake::operator !=(uint64_t const& other) const
bool snowflake::operator != (uint64_t other) const
{
return !(*this == other);
return !(static_cast<uint64_t>(*this) == other);
}

bool snowflake::operator ==(uint64_t const& other) const
bool snowflake::operator ==(uint64_t other) const
{
return static_cast<uint64_t>(*this) == other;
}
Expand Down

0 comments on commit 4525611

Please sign in to comment.