Skip to content

Commit 2aad515

Browse files
author
tobo
committed
PopCount => std::popcount
commit_hash:5535d20d4cf079f3d5432ac63041f1af155063e7
1 parent 1017fdd commit 2aad515

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

yql/essentials/minikql/invoke_builtins/mkql_builtins_countbits.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "mkql_builtins_impl.h" // Y_IGNORE // Y_IGNORE
22

3-
#include <library/cpp/pop_count/popcount.h>
3+
#include <bit>
4+
#include <type_traits>
45

56
namespace NKikimr {
67
namespace NMiniKQL {
@@ -11,7 +12,11 @@ template<typename TInput, typename TOutput>
1112
struct TCountBits : public TSimpleArithmeticUnary<TInput, TOutput, TCountBits<TInput, TOutput>> {
1213
static TOutput Do(TInput val)
1314
{
14-
return PopCount(val);
15+
if constexpr (std::is_signed_v<TInput>) {
16+
return std::popcount(static_cast<std::make_unsigned_t<TInput>>(val));
17+
} else {
18+
return std::popcount(val);
19+
}
1520
}
1621

1722
#ifndef MKQL_DISABLE_CODEGEN

yql/essentials/minikql/invoke_builtins/ya.make.inc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ SET(ORIG_SOURCES
4747
)
4848

4949
PEERDIR(
50-
library/cpp/pop_count
5150
yql/essentials/types/binary_json
5251
yql/essentials/minikql
5352
yql/essentials/minikql/arrow
@@ -65,7 +64,7 @@ COPY(
6564
AUTO
6665
FROM ${ORIG_SRC_DIR}
6766
${ORIG_SOURCES}
68-
OUTPUT_INCLUDES
67+
OUTPUT_INCLUDES
6968
${BINDIR}/yql/essentials/minikql/invoke_builtins/mkql_builtins_impl.h
7069
${BINDIR}/yql/essentials/minikql/invoke_builtins/mkql_builtins_decimal.h
7170
)

0 commit comments

Comments
 (0)