| 161 | return (lhs.bits() == rhs.bits()) || (lhs.is_zero() && rhs.is_zero()); |
| 162 | } |
| 163 | static constexpr bool CompareLt(Float16 lhs, Float16 rhs) { |
| 164 | if (lhs.signbit()) { |
| 165 | if (rhs.signbit()) { |
| 166 | // Both are negative |
| 167 | return lhs.bits() > rhs.bits(); |
| 168 | } else { |
| 169 | // Handle +/-0 |
| 170 | return !lhs.is_zero() || rhs.bits() != 0; |
| 171 | } |
| 172 | } else if (rhs.signbit()) { |
| 173 | return false; |
| 174 | } else { |
| 175 | // Both are positive |
| 176 | return lhs.bits() < rhs.bits(); |
| 177 | } |
| 178 | } |
| 179 | }; |
| 180 | |
| 181 | static_assert(std::is_standard_layout_v<Float16>); |
no test coverage detected