| 72 | */ |
| 73 | template <class T> |
| 74 | static constexpr size_t NumericHash(T t) noexcept { |
| 75 | if constexpr (std::is_floating_point<T>::value) { |
| 76 | if (t == T(0)) { // the negative zero is equal to the positive zero, but has different bitwise representation |
| 77 | t = T(0); // make sure that the hash will be the same for both kind of zeros |
| 78 | } |
| 79 | } |
| 80 | using TCvt = TFixedWidthUnsignedInt<T>; |
| 81 | |
| 82 | union Y_HIDDEN { |
| 83 | T t; |
| 84 | TCvt cvt; |
| 85 | } u{t}; |
| 86 | |
| 87 | return (size_t)IntHash(u.cvt); |
| 88 | } |
| 89 | |
| 90 | template <class T> |
| 91 | [[nodiscard]] static constexpr T CombineHashes(T l, T r) noexcept { |
no test coverage detected