Gabriel39 commented on code in PR #13536: URL: https://github.com/apache/doris/pull/13536#discussion_r1001333560
########## be/src/util/hash_util.hpp: ########## @@ -45,11 +45,19 @@ namespace doris { // Utility class to compute hash values. class HashUtil { public: + // like hash_combine but without hash + static inline uint32_t direct_combine(uint32_t x, uint32_t y) { + return x + 0x9e3779b9 + (y << 6) + (y >> 2); + } + template <typename T> static uint32_t fixed_len_to_uint32(T value) { if constexpr (sizeof(T) <= sizeof(uint32_t)) { return value; + } else if constexpr (sizeof(T) == sizeof(uint64_t)) { + return direct_combine(((uint64_t)value << 32) >> 32, (uint64_t)value >> 32); Review Comment: using `value & (((uint32_t) 0) - 1)` to extract low bits is more efficient? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org