MCPcopy Create free account
hub / github.com/catboost/catboost / NumericHash

Function NumericHash

util/digest/numeric.h:74–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72 */
73template <class T>
74static 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
90template <class T>
91[[nodiscard]] static constexpr T CombineHashes(T l, T r) noexcept {

Callers 3

operator()Method · 0.85
operator()Method · 0.85
operator()Method · 0.85

Calls 2

IntHashFunction · 0.85
TClass · 0.50

Tested by

no test coverage detected