mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Merge pull request #21307 from amosbird/moduleopt
Specialize intDiv/module
This commit is contained in:
commit
bd7b540b82
@ -24,9 +24,25 @@ template <typename A, typename B>
|
||||
struct DivideIntegralByConstantImpl
|
||||
: BinaryOperation<A, B, DivideIntegralImpl<A, B>>
|
||||
{
|
||||
using ResultType = typename DivideIntegralImpl<A, B>::ResultType;
|
||||
using Op = DivideIntegralImpl<A, B>;
|
||||
using ResultType = typename Op::ResultType;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
|
||||
template <OpCase op_case>
|
||||
static void NO_INLINE process(const A * __restrict a, const B * __restrict b, ResultType * __restrict c, size_t size)
|
||||
{
|
||||
if constexpr (op_case == OpCase::Vector)
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
c[i] = Op::template apply<ResultType>(a[i], b[i]);
|
||||
else if constexpr (op_case == OpCase::LeftConstant)
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
c[i] = Op::template apply<ResultType>(*a, b[i]);
|
||||
else
|
||||
vectorConstant(a, *b, c, size);
|
||||
}
|
||||
|
||||
static ResultType process(A a, B b) { return Op::template apply<ResultType>(a, b); }
|
||||
|
||||
static NO_INLINE void vectorConstant(const A * __restrict a_pos, B b, ResultType * __restrict c_pos, size_t size)
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
|
@ -24,10 +24,26 @@ template <typename A, typename B>
|
||||
struct ModuloByConstantImpl
|
||||
: BinaryOperation<A, B, ModuloImpl<A, B>>
|
||||
{
|
||||
using ResultType = typename ModuloImpl<A, B>::ResultType;
|
||||
using Op = ModuloImpl<A, B>;
|
||||
using ResultType = typename Op::ResultType;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
|
||||
static NO_INLINE void vectorConstant(const A * __restrict src, B b, ResultType * __restrict dst, size_t size)
|
||||
template <OpCase op_case>
|
||||
static void NO_INLINE process(const A * __restrict a, const B * __restrict b, ResultType * __restrict c, size_t size)
|
||||
{
|
||||
if constexpr (op_case == OpCase::Vector)
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
c[i] = Op::template apply<ResultType>(a[i], b[i]);
|
||||
else if constexpr (op_case == OpCase::LeftConstant)
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
c[i] = Op::template apply<ResultType>(*a, b[i]);
|
||||
else
|
||||
vectorConstant(a, *b, c, size);
|
||||
}
|
||||
|
||||
static ResultType process(A a, B b) { return Op::template apply<ResultType>(a, b); }
|
||||
|
||||
static void NO_INLINE vectorConstant(const A * __restrict src, B b, ResultType * __restrict dst, size_t size)
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsign-compare"
|
||||
|
Loading…
Reference in New Issue
Block a user