1 | #include <Functions/FunctionMathUnary.h> |
---|---|
2 | #include <Functions/FunctionFactory.h> |
3 | |
4 | namespace DB |
5 | { |
6 | |
7 | struct LogName { static constexpr auto name = "log"; }; |
8 | |
9 | #if USE_FASTOPS |
10 | |
11 | namespace |
12 | { |
13 | struct Impl |
14 | { |
15 | static constexpr auto name = LogName::name; |
16 | static constexpr auto rows_per_iteration = 0; |
17 | static constexpr bool always_returns_float64 = false; |
18 | |
19 | template <typename T> |
20 | static void execute(const T * src, size_t size, T * dst) |
21 | { |
22 | NFastOps::Log<true>(src, size, dst); |
23 | } |
24 | }; |
25 | } |
26 | |
27 | using FunctionLog = FunctionMathUnary<Impl>; |
28 | |
29 | #else |
30 | using FunctionLog = FunctionMathUnary<UnaryFunctionVectorized<LogName, log>>; |
31 | #endif |
32 | |
33 | void registerFunctionLog(FunctionFactory & factory) |
34 | { |
35 | factory.registerFunction<FunctionLog>(FunctionFactory::CaseInsensitive); |
36 | factory.registerAlias("ln", "log", FunctionFactory::CaseInsensitive); |
37 | } |
38 | |
39 | } |
40 |