MCPcopy Create free account
hub / github.com/apache/arrow / Log2

Function Log2

cpp/src/arrow/util/bit_util.h:139–150  ·  view source on GitHub ↗

Returns ceil(log2(x)).

Source from the content-addressed store, hash-verified

137
138// Returns ceil(log2(x)).
139static inline int Log2(uint64_t x) {
140 // DCHECK_GT(x, 0);
141
142// TODO: We can remove this condition once CRAN upgrades its macOS
143// SDK from 11.3.
144// __apple_build_version__ should be defined only on Apple clang
145#if defined(__apple_build_version__) && !defined(__cpp_lib_bitops)
146 return std::log2p1(x - 1);
147#else
148 return std::bit_width(x - 1);
149#endif
150}
151
152//
153// Utilities for reading and writing individual bits by their index

Callers 13

TESTFunction · 0.70
RowArrayDecodeBenchmarkFunction · 0.50
CreateEmptyMethod · 0.50
BeginMethod · 0.50
PrepareForMergeMethod · 0.50
InitMethod · 0.50
FlushBuildColumnMethod · 0.50
bit_widthMethod · 0.50
SetDataMethod · 0.50
SetDataV2Method · 0.50
InitMethod · 0.50

Calls 1

bit_widthFunction · 0.50

Tested by 1

TESTFunction · 0.56