diff --git a/dbms/src/Functions/bitCount.cpp b/dbms/src/Functions/bitCount.cpp
index 433a5ed9bee..78bca5c4f1b 100644
--- a/dbms/src/Functions/bitCount.cpp
+++ b/dbms/src/Functions/bitCount.cpp
@@ -20,6 +20,10 @@ struct BitCountImpl
return __builtin_popcountll(a);
if constexpr (std::is_same_v || std::is_same_v || std::is_unsigned_v)
return __builtin_popcount(a);
+ if constexpr (std::is_same_v)
+ return __builtin_popcount(static_cast(a));
+ if constexpr (std::is_same_v)
+ return __builtin_popcount(static_cast(a));
else
return __builtin_popcountll(ext::bit_cast(a));
}