24#ifndef SQL_JOIN_OPTIMIZER_BIT_UTILS_H
25#define SQL_JOIN_OPTIMIZER_BIT_UTILS_H 1
34#pragma intrinsic(_BitScanForward64)
35#pragma intrinsic(_BitScanReverse64)
40template <
class Policy>
75 _BitScanForward64(&idx, x);
77#elif defined(__GNUC__) && defined(__x86_64__)
84 asm(
"bsfq %1,%q0" :
"=r"(idx) :
"rm"(x));
88 return static_cast<unsigned>(ffsll(x)) - 1u;
104 return state & (state - 1);
116 _BitScanReverse64(&idx, state);
119 return __builtin_clzll(state) ^ 63u;
127 return state & ~(uint64_t{1} <<
NextValue(state));
186constexpr uint64_t
TableBitmap(
unsigned x) {
return uint64_t{1} << x; }
189template <
typename... Args>
206 return -(uint64_t{1} <<
start);
209 return (uint64_t{1} <<
end) - (uint64_t{1} <<
start);
229inline
bool IsSubset(uint64_t x, uint64_t y) {
return (x & y) == x; }
237inline bool Overlaps(uint64_t x, uint64_t y) {
return (x & y) != 0; }
249 return Overlaps(x, uint64_t{1} << bit_num);
bool IsProperSubset(uint64_t x, uint64_t y)
Returns whether X is a proper subset of Y.
Definition: bit_utils.h:232
uint64_t TablesBetween(unsigned start, unsigned end)
Definition: bit_utils.h:215
bool AreMultipleBitsSet(uint64_t x)
Definition: bit_utils.h:240
bool IsSingleBitSet(uint64_t x)
Definition: bit_utils.h:243
BitIteratorAdaptor< CountBitsDescending > BitsSetInDescending(uint64_t state)
Definition: bit_utils.h:134
bool IsSubset(uint64_t x, uint64_t y)
Definition: bit_utils.h:229
constexpr uint64_t TableBitmap(unsigned x)
Definition: bit_utils.h:186
uint64_t IsolateLowestBit(uint64_t x)
Definition: bit_utils.h:225
bool Overlaps(uint64_t x, uint64_t y)
Definition: bit_utils.h:237
uint64_t BitsBetween(unsigned start, unsigned end)
Definition: bit_utils.h:199
bool IsBitSet(int bit_num, uint64_t x)
Definition: bit_utils.h:248
int PopulationCount(uint64_t x)
Definition: bit_utils.h:253
BitIteratorAdaptor< CountBitsAscending > BitsSetIn(uint64_t state)
Definition: bit_utils.h:131
size_t FindLowestBitSet(uint64_t x)
Definition: bit_utils.h:71
Definition: bit_utils.h:43
bool operator!=(const iterator &other) const
Definition: bit_utils.h:52
iterator & operator++()
Definition: bit_utils.h:56
size_t operator*() const
Definition: bit_utils.h:55
uint64_t m_state
Definition: bit_utils.h:45
bool operator==(const iterator &other) const
Definition: bit_utils.h:49
iterator(uint64_t state)
Definition: bit_utils.h:48
Definition: bit_utils.h:41
const uint64_t m_initial_state
Definition: bit_utils.h:68
BitIteratorAdaptor(uint64_t state)
Definition: bit_utils.h:62
iterator begin() const
Definition: bit_utils.h:64
iterator end() const
Definition: bit_utils.h:65
Definition: bit_utils.h:94
static size_t NextValue(uint64_t state)
Definition: bit_utils.h:96
static uint64_t AdvanceState(uint64_t state)
Definition: bit_utils.h:101
Definition: bit_utils.h:109
static size_t NextValue(uint64_t state)
Definition: bit_utils.h:111
static uint64_t AdvanceState(uint64_t state)
Definition: bit_utils.h:123
Definition: bit_utils.h:149
bool operator!=(const iterator &other) const
Definition: bit_utils.h:160
uint64_t m_state
Definition: bit_utils.h:151
iterator & operator++()
Definition: bit_utils.h:165
uint64_t operator*() const
Definition: bit_utils.h:164
iterator(uint64_t state, uint64_t set)
Definition: bit_utils.h:155
uint64_t m_set
Definition: bit_utils.h:152
bool operator==(const iterator &other) const
Definition: bit_utils.h:156
Definition: bit_utils.h:147
NonzeroSubsetsOf(uint64_t set)
Definition: bit_utils.h:171
iterator end() const
Definition: bit_utils.h:179
const uint64_t m_set
Definition: bit_utils.h:182
iterator begin() const
Definition: bit_utils.h:177
static void start(mysql_harness::PluginFuncEnv *env)
Definition: http_auth_backend_plugin.cc:177
Header for compiler-dependent features.
#define MY_COMPILER_MSVC_DIAGNOSTIC_IGNORE(X)
Definition: my_compiler.h:266
#define MY_COMPILER_DIAGNOSTIC_PUSH()
save the compiler's diagnostic (enabled warnings, errors, ...) state
Definition: my_compiler.h:296
#define MY_COMPILER_DIAGNOSTIC_POP()
restore the compiler's diagnostic (enabled warnings, errors, ...) state
Definition: my_compiler.h:297
static int count
Definition: myisam_ftdump.cc:43
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
std::set< Key, Compare, ut::allocator< Key > > set
Specialization of set which uses ut_allocator.
Definition: ut0new.h:2883