GRPC Core 0.10.0.0

- Main Page
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros
useful.h File Reference

Go to the source code of this file.

## Macros
#define | GPR_MIN(a, b) ((a) < (b) ? (a) : (b))
#define | GPR_MAX(a, b) ((a) > (b) ? (a) : (b))
#define | GPR_CLAMP(a, min, max) ((a) < (min) ? (min) : (a) > (max) ? (max) : (a))
#define | GPR_ROTL(x, n) (((x) << (n)) | ((x) >> (sizeof(x) * 8 - (n))))
#define | GPR_ROTR(x, n) (((x) >> (n)) | ((x) << (sizeof(x) * 8 - (n))))
#define | GPR_ARRAY_SIZE(array) (sizeof(array) / sizeof(*(array)))
#define | GPR_SWAP(type, a, b)
#define | GPR_BITSET(i, n) ((*(i)) |= (1u << (n)))
| Set the n-th bit of i (a mutable pointer). More...
#define | GPR_BITCLEAR(i, n) ((*(i)) &= ~(1u << (n)))
| Clear the n-th bit of i (a mutable pointer). More...
#define | GPR_BITGET(i, n) (((i) & (1u << (n))) != 0)
| Get the n-th bit of i. More...
#define | GPR_INTERNAL_HEXDIGIT_BITCOUNT(x)
#define | GPR_BITCOUNT(i)
| Returns number of bits set in bitset i. More...

## Macro Definition Documentation

#define GPR_ARRAY_SIZE | ( |  | array | ) | (sizeof(array) / sizeof(*(array)))

#define GPR_BITCLEAR | ( |  | i,
|  |  | n
| ) |  | ((*(i)) &= ~(1u << (n)))

Clear the n-th bit of i (a mutable pointer).

#define GPR_BITCOUNT | ( |  | i | ) |

Value:
(((GPR_INTERNAL_HEXDIGIT_BITCOUNT(i) + \
(GPR_INTERNAL_HEXDIGIT_BITCOUNT(i) >> 4)) & \
0x0f0f0f0f) % \
255)
GPR_INTERNAL_HEXDIGIT_BITCOUNT
#define GPR_INTERNAL_HEXDIGIT_BITCOUNT(x)
Definition: useful.h:64

Returns number of bits set in bitset i.

#define GPR_BITGET | ( |  | i,
|  |  | n
| ) |  | (((i) & (1u << (n))) != 0)

Get the n-th bit of i.

#define GPR_BITSET | ( |  | i,
|  |  | n
| ) |  | ((*(i)) |= (1u << (n)))

Set the n-th bit of i (a mutable pointer).

#define GPR_CLAMP | ( |  | a,
|  |  | min,
|  |  | max
| ) |  | ((a) < (min) ? (min) : (a) > (max) ? (max) : (a))

#define GPR_INTERNAL_HEXDIGIT_BITCOUNT | ( |  | x | ) |

Value:
((x) - (((x) >> 1) & 0x77777777) - (((x) >> 2) & 0x33333333) - \
(((x) >> 3) & 0x11111111))

#define GPR_MAX | ( |  | a,
|  |  | b
| ) |  | ((a) > (b) ? (a) : (b))

#define GPR_MIN | ( |  | a,
|  |  | b
| ) |  | ((a) < (b) ? (a) : (b))

#define GPR_ROTL | ( |  | x,
|  |  | n
| ) |  | (((x) << (n)) | ((x) >> (sizeof(x) * 8 - (n))))

#define GPR_ROTR | ( |  | x,
|  |  | n
| ) |  | (((x) >> (n)) | ((x) << (sizeof(x) * 8 - (n))))

#define GPR_SWAP | ( |  | type,
|  |  | a,
|  |  | b
| ) |  |

Value:
do { \
type x = a; \
a = b; \
b = x; \
} while (0)