24#ifndef SQL_JOIN_OPTIMIZER_BIT_UTILS_H
25#define SQL_JOIN_OPTIMIZER_BIT_UTILS_H 1
35template <
class Policy>
68#if defined(__GNUC__) && defined(__x86_64__)
83 asm(
"bsfq %1,%q0" :
"=r"(idx) :
"rm"(x));
86 return std::countr_zero(x);
102 return state & (state - 1);
112 return std::countl_zero(state) ^ 63u;
119 return state & ~(uint64_t{1} <<
NextValue(state));
178constexpr uint64_t
TableBitmap(
unsigned x) {
return uint64_t{1} << x; }
181template <
typename... Args>
198 return -(uint64_t{1} <<
start);
201 return (uint64_t{1} <<
end) - (uint64_t{1} <<
start);
221inline
bool IsSubset(uint64_t x, uint64_t y) {
return (x & y) == x; }
229inline bool Overlaps(uint64_t x, uint64_t y) {
return (x & y) != 0; }
233 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:224
uint64_t TablesBetween(unsigned start, unsigned end)
Definition: bit_utils.h:207
BitIteratorAdaptor< CountBitsDescending > BitsSetInDescending(uint64_t state)
Definition: bit_utils.h:126
bool IsSubset(uint64_t x, uint64_t y)
Definition: bit_utils.h:221
constexpr uint64_t TableBitmap(unsigned x)
Definition: bit_utils.h:178
uint64_t IsolateLowestBit(uint64_t x)
Definition: bit_utils.h:217
bool Overlaps(uint64_t x, uint64_t y)
Definition: bit_utils.h:229
uint64_t BitsBetween(unsigned start, unsigned end)
Definition: bit_utils.h:191
bool IsBitSet(int bit_num, uint64_t x)
Definition: bit_utils.h:232
BitIteratorAdaptor< CountBitsAscending > BitsSetIn(uint64_t state)
Definition: bit_utils.h:123
size_t FindLowestBitSet(uint64_t x)
Definition: bit_utils.h:66
Definition: bit_utils.h:38
bool operator!=(const iterator &other) const
Definition: bit_utils.h:47
iterator & operator++()
Definition: bit_utils.h:51
size_t operator*() const
Definition: bit_utils.h:50
uint64_t m_state
Definition: bit_utils.h:40
bool operator==(const iterator &other) const
Definition: bit_utils.h:44
iterator(uint64_t state)
Definition: bit_utils.h:43
Definition: bit_utils.h:36
const uint64_t m_initial_state
Definition: bit_utils.h:63
BitIteratorAdaptor(uint64_t state)
Definition: bit_utils.h:57
iterator begin() const
Definition: bit_utils.h:59
iterator end() const
Definition: bit_utils.h:60
Definition: bit_utils.h:92
static size_t NextValue(uint64_t state)
Definition: bit_utils.h:94
static uint64_t AdvanceState(uint64_t state)
Definition: bit_utils.h:99
Definition: bit_utils.h:107
static size_t NextValue(uint64_t state)
Definition: bit_utils.h:109
static uint64_t AdvanceState(uint64_t state)
Definition: bit_utils.h:115
Definition: bit_utils.h:141
bool operator!=(const iterator &other) const
Definition: bit_utils.h:152
uint64_t m_state
Definition: bit_utils.h:143
iterator & operator++()
Definition: bit_utils.h:157
uint64_t operator*() const
Definition: bit_utils.h:156
iterator(uint64_t state, uint64_t set)
Definition: bit_utils.h:147
uint64_t m_set
Definition: bit_utils.h:144
bool operator==(const iterator &other) const
Definition: bit_utils.h:148
Definition: bit_utils.h:139
NonzeroSubsetsOf(uint64_t set)
Definition: bit_utils.h:163
iterator end() const
Definition: bit_utils.h:171
const uint64_t m_set
Definition: bit_utils.h:174
iterator begin() const
Definition: bit_utils.h:169
static void start(mysql_harness::PluginFuncEnv *env)
Definition: http_auth_backend_plugin.cc:180
Header for compiler-dependent features.
#define MY_COMPILER_MSVC_DIAGNOSTIC_IGNORE(X)
Definition: my_compiler.h:247
#define MY_COMPILER_DIAGNOSTIC_PUSH()
save the compiler's diagnostic (enabled warnings, errors, ...) state
Definition: my_compiler.h:277
#define MY_COMPILER_DIAGNOSTIC_POP()
restore the compiler's diagnostic (enabled warnings, errors, ...) state
Definition: my_compiler.h:278
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:2884