MySQL 8.0.39
Source Code Documentation
my_bit.h File Reference

Some useful bit functions. More...

#include <sys/types.h>
#include "my_config.h"
#include "my_inttypes.h"
#include "my_macros.h"

Go to the source code of this file.

Functions

static uint my_bit_log2 (ulong value)
 
static uint my_count_bits (ulonglong v)
 
static uint my_count_bits_uint32 (uint32 v)
 
static uint32 my_round_up_to_next_power (uint32 v)
 
static uint32 my_clear_highest_bit (uint32 v)
 
static uint32 my_reverse_bits (uint32 key)
 
template<typename IntType >
constexpr bool is_single_bit (IntType bits)
 Determine if a single bit is set among some bits. More...
 

Variables

const char _my_bits_nbits [256]
 
const uchar _my_bits_reverse_table [256]
 

Detailed Description

Some useful bit functions.

Function Documentation

◆ is_single_bit()

template<typename IntType >
constexpr bool is_single_bit ( IntType  bits)
constexpr

Determine if a single bit is set among some bits.

Template Parameters
IntTypean integer type
Parameters
bitsthe bits to examine
Return values
trueif bits equals to a power of 2
falseotherwise

◆ my_bit_log2()

static uint my_bit_log2 ( ulong  value)
inlinestatic

◆ my_clear_highest_bit()

static uint32 my_clear_highest_bit ( uint32  v)
inlinestatic

◆ my_count_bits()

static uint my_count_bits ( ulonglong  v)
inlinestatic

◆ my_count_bits_uint32()

static uint my_count_bits_uint32 ( uint32  v)
inlinestatic

◆ my_reverse_bits()

static uint32 my_reverse_bits ( uint32  key)
inlinestatic

◆ my_round_up_to_next_power()

static uint32 my_round_up_to_next_power ( uint32  v)
inlinestatic

Variable Documentation

◆ _my_bits_nbits

const char _my_bits_nbits[256]
extern

◆ _my_bits_reverse_table

const uchar _my_bits_reverse_table[256]
extern