#include #include namespace DB { template struct BitHammingDistanceImpl { using ResultType = UInt8; static const constexpr bool allow_fixed_string = false; static const constexpr bool allow_string_integer = false; template static inline NO_SANITIZE_UNDEFINED Result apply(A a, B b) { UInt64 res = static_cast(a) ^ static_cast(b); return __builtin_popcountll(res); } #if USE_EMBEDDED_COMPILER static constexpr bool compilable = false; /// special type handling, some other time #endif }; struct NameBitHammingDistance { static constexpr auto name = "bitHammingDistance"; }; using FunctionBitHammingDistance = BinaryArithmeticOverloadResolver; REGISTER_FUNCTION(BitHammingDistance) { factory.registerFunction(); } }