mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-17 20:02:05 +00:00
e00ce0bb57
* Every function in its own file, part 7 [#CLICKHOUSE-2] * Every function in its own file, part 7 [#CLICKHOUSE-2] * Every function in its own file, part 7 [#CLICKHOUSE-2] * Every function in its own file, part 7 [#CLICKHOUSE-2] * Every function in its own file, part 7 [#CLICKHOUSE-2] * Fixed build #3666
32 lines
748 B
C++
32 lines
748 B
C++
#include <Functions/FunctionFactory.h>
|
|
#include <Functions/FunctionBinaryArithmetic.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
template <typename A, typename B>
|
|
struct BitTestImpl
|
|
{
|
|
using ResultType = UInt8;
|
|
|
|
template <typename Result = ResultType>
|
|
static inline Result apply(A a, B b)
|
|
{
|
|
return (typename NumberTraits::ToInteger<A>::Type(a) >> typename NumberTraits::ToInteger<B>::Type(b)) & 1;
|
|
}
|
|
|
|
#if USE_EMBEDDED_COMPILER
|
|
static constexpr bool compilable = false; /// TODO
|
|
#endif
|
|
};
|
|
|
|
struct NameBitTest { static constexpr auto name = "bitTest"; };
|
|
using FunctionBitTest = FunctionBinaryArithmetic<BitTestImpl, NameBitTest>;
|
|
|
|
void registerFunctionBitTest(FunctionFactory & factory)
|
|
{
|
|
factory.registerFunction<FunctionBitTest>();
|
|
}
|
|
|
|
}
|