|
12 | 12 | #include "src/__support/CPP/bit.h"
|
13 | 13 | #include "src/__support/CPP/type_traits.h"
|
14 | 14 | #include "src/__support/FPUtil/cast.h"
|
| 15 | +#include "src/__support/FPUtil/comparison_operations.h" |
15 | 16 | #include "src/__support/FPUtil/dyadic_float.h"
|
16 | 17 | #include "src/__support/macros/config.h"
|
17 | 18 | #include "src/__support/macros/properties/types.h"
|
@@ -57,6 +58,30 @@ struct BFloat16 {
|
57 | 58 | uint32_t x_bits = static_cast<uint32_t>(bits) << 16U;
|
58 | 59 | return cpp::bit_cast<float>(x_bits);
|
59 | 60 | }
|
| 61 | + |
| 62 | + LIBC_INLINE constexpr bool operator==(BFloat16 other) const { |
| 63 | + return fputil::equals(*this, other); |
| 64 | + } |
| 65 | + |
| 66 | + LIBC_INLINE constexpr bool operator!=(BFloat16 other) const { |
| 67 | + return !fputil::equals(*this, other); |
| 68 | + } |
| 69 | + |
| 70 | + LIBC_INLINE constexpr bool operator<(BFloat16 other) const { |
| 71 | + return fputil::less_than(*this, other); |
| 72 | + } |
| 73 | + |
| 74 | + LIBC_INLINE constexpr bool operator<=(BFloat16 other) const { |
| 75 | + return fputil::less_than_or_equals(*this, other); |
| 76 | + } |
| 77 | + |
| 78 | + LIBC_INLINE constexpr bool operator>(BFloat16 other) const { |
| 79 | + return fputil::greater_than(*this, other); |
| 80 | + } |
| 81 | + |
| 82 | + LIBC_INLINE constexpr bool operator>=(BFloat16 other) const { |
| 83 | + return fputil::greater_than_or_equals(*this, other); |
| 84 | + } |
60 | 85 | }; // struct BFloat16
|
61 | 86 |
|
62 | 87 | } // namespace fputil
|
|
0 commit comments