Skip to content

Commit

Permalink
Made the same with signed class.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alvov1 committed Dec 1, 2024
1 parent bea01c6 commit 080981f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
16 changes: 6 additions & 10 deletions Aesi.h
Original file line number Diff line number Diff line change
Expand Up @@ -632,23 +632,19 @@ class Aesi final {
return our.compareTo(integral) == Comparison::equal;
}

/**
* @brief Equality operator
* @param our Aesi
* @param other Aesi
* @return bool
*/
gpu constexpr friend auto operator==(const Aesi& our, const Aesi& other) noexcept -> bool = default;

/**
* @brief Different precision equlity operator
* @param our Aesi
* @param other Aesi
* @return bool
*/
template <std::size_t otherBitness> requires (otherBitness != bitness)
template <std::size_t otherBitness>
gpu constexpr friend auto operator==(const Aesi& our, const Aesi<otherBitness>& other) noexcept -> bool {
return our.precisionCast<otherBitness>() == other;
if constexpr (bitness == otherBitness) {
return our.compareTo(other) == Comparison::equal;
} else {
return our.precisionCast<otherBitness>() == other;
}
}
/* --------------------------------------------------------------------------- */

Expand Down
10 changes: 1 addition & 9 deletions Aeu.h
Original file line number Diff line number Diff line change
Expand Up @@ -755,14 +755,6 @@ class Aeu final {
return our.filledBlocksNumber() <= 2 && (static_cast<uint64_t>(our.blocks[1]) << blockBitLength | static_cast<uint64_t>(our.blocks[0])) == other;
}

/**
* @brief Equality check operator for numbers of the same precision
* @param our Aeu
* @param other Aeu
* @return Boolean
*/
// gpu constexpr friend auto operator==(const Aeu& our, const Aeu& other) noexcept -> bool = default;

/**
* @brief Templated Equality check operator for numbers of different precision
* @param our Aeu
Expand All @@ -772,7 +764,7 @@ class Aeu final {
template <std::size_t otherBitness>
gpu constexpr friend auto operator==(const Aeu& our, const Aeu<otherBitness>& other) noexcept -> bool {
return our.compareTo(other) == Comparison::equal;
};
}
/* --------------------------------------------------------------------------- */


Expand Down

0 comments on commit 080981f

Please sign in to comment.