#include #include #include namespace DB { namespace ErrorCodes { extern const int NOT_IMPLEMENTED; } namespace { template struct BitTestImpl { using ResultType = UInt8; static const constexpr bool allow_fixed_string = false; template NO_SANITIZE_UNDEFINED static inline Result apply(A a [[maybe_unused]], B b [[maybe_unused]]) { if constexpr (is_big_int_v || is_big_int_v) throw Exception("bitTest is not implemented for big integers as second argument", ErrorCodes::NOT_IMPLEMENTED); else return (typename NumberTraits::ToInteger::Type(a) >> typename NumberTraits::ToInteger::Type(b)) & 1; } #if USE_EMBEDDED_COMPILER static constexpr bool compilable = false; /// TODO #endif }; struct NameBitTest { static constexpr auto name = "bitTest"; }; using FunctionBitTest = BinaryArithmeticOverloadResolver; } void registerFunctionBitTest(FunctionFactory & factory) { factory.registerFunction(); } }