aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/minikql/invoke_builtins/mkql_builtins_bitnot.cpp
blob: 864e68fed13a7de054d83500c9f21b2a6851b3e9 (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 TInput, typename TOutput>
struct TBitNot : public TSimpleArithmeticUnary<TInput, TOutput, TBitNot<TInput, TOutput>> {
    static TOutput Do(TInput val)
    {
        return ~val;
    }

#ifndef MKQL_DISABLE_CODEGEN
    static Value* Gen(Value* arg, const TCodegenContext&, BasicBlock*& block)
    {
        return BinaryOperator::CreateNot(arg, "not", block);
    }
#endif
};

}

void RegisterBitNot(IBuiltinFunctionRegistry& registry) {
    RegisterUnaryUnsignedFunctionOpt<TBitNot, TUnaryArgsOpt>(registry, "BitNot");
}

} // namespace NMiniKQL
} // namespace NKikimr