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

Function Log2

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

Returns ceil(log2(x)).

Source from the content-addressed store, hash-verified

140
141// Returns ceil(log2(x)).
142static inline int Log2(uint64_t x) {
143 // DCHECK_GT(x, 0);
144
145// TODO: We can remove this condition once CRAN upgrades its macOS
146// SDK from 11.3.
147// __apple_build_version__ should be defined only on Apple clang
148#if defined(__apple_build_version__) && !defined(__cpp_lib_bitops)
149 return std::log2p1(x - 1);
150#else
151 return std::bit_width(x - 1);
152#endif
153}
154
155//
156// 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