MySQL  8.0.17
Source Code Documentation
my_macros.h File Reference

Some common macros. More...

#include <stddef.h>

Go to the source code of this file.

Macros

#define C_MODE_START   extern "C" {
 
#define C_MODE_END   }
 
#define IF_WIN(A, B)   B
 
#define QUOTE_ARG(x)   #x /* Quote argument (before cpp) */
 
#define STRINGIFY_ARG(x)   QUOTE_ARG(x) /* Quote argument, after cpp */
 
#define MY_TEST(a)   ((a) ? 1 : 0)
 
#define MY_MAX(a, b)   ((a) > (b) ? (a) : (b))
 
#define MY_MIN(a, b)   ((a) < (b) ? (a) : (b))
 
#define set_if_bigger(a, b)
 
#define set_if_smaller(a, b)
 
#define test_all_bits(a, b)   (((a) & (b)) == (b))
 

Functions

template<class T , size_t N>
constexpr size_t array_elements (T(&)[N]) noexcept
 

Detailed Description

Some common macros.

Note that some of these should probably be replaced with code from <algorithm> or similar.

Macro Definition Documentation

◆ C_MODE_END

#define C_MODE_END   }

◆ C_MODE_START

#define C_MODE_START   extern "C" {

◆ IF_WIN

#define IF_WIN (   A,
 
)    B

◆ MY_MAX

#define MY_MAX (   a,
 
)    ((a) > (b) ? (a) : (b))

◆ MY_MIN

#define MY_MIN (   a,
 
)    ((a) < (b) ? (a) : (b))

◆ MY_TEST

#define MY_TEST (   a)    ((a) ? 1 : 0)

◆ QUOTE_ARG

#define QUOTE_ARG (   x)    #x /* Quote argument (before cpp) */

◆ set_if_bigger

#define set_if_bigger (   a,
 
)
Value:
do { \
if ((a) < (b)) (a) = (b); \
} while (0)

◆ set_if_smaller

#define set_if_smaller (   a,
 
)
Value:
do { \
if ((a) > (b)) (a) = (b); \
} while (0)

◆ STRINGIFY_ARG

#define STRINGIFY_ARG (   x)    QUOTE_ARG(x) /* Quote argument, after cpp */

◆ test_all_bits

#define test_all_bits (   a,
 
)    (((a) & (b)) == (b))

Function Documentation

◆ array_elements()

template<class T , size_t N>
constexpr size_t array_elements ( T(&)  [N])
noexcept