aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/minikql/invoke_builtins/mkql_builtins_bitxor.cpp
blob: 018faee16a22ebd681560f7ac5b2eee085c02077 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "mkql_builtins_impl.h"  // Y_IGNORE

namespace NKikimr {
namespace NMiniKQL {

namespace {

template<typename TLeft, typename TRight, typename TOutput>
struct TBitXor : public TSimpleArithmeticBinary<TLeft, TRight, TOutput, TBitXor<TLeft, TRight, TOutput>> {
    static TOutput Do(TOutput left, TOutput right)
    {
        return left ^ right;
    }

#ifndef MKQL_DISABLE_CODEGEN
    static Value* Gen(Value* left, Value* right, const TCodegenContext&, BasicBlock*& block)
    {
        return BinaryOperator::CreateXor(left, right, "xor", block);
    }
#endif
};

}

void RegisterBitXor(IBuiltinFunctionRegistry& registry) {
    RegisterBinaryUnsignedFunctionOpt<TBitXor, TBinaryArgsOpt>(registry, "BitXor");
}

} // namespace NMiniKQL
} // namespace NKikimr