libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_macro_utils.h File Reference

Go to the source code of this file.

Macros

#define GBL_MIN(a, b)
 
#define GBL_MAX(a, b)
 
#define GBL_CEIL(numerator, denominator)
 
#define GBL_CLAMP(n, min, max)
 
#define GBL_BIT_MASK_2(bits, offset)
 
#define GBL_BIT_MASK_1(bits)
 
#define GBL_BIT_MASK(...)
 
#define GBL_BCD_BYTE_PACK(n)
 
#define GBL_BCD_BYTE_UNPACK(n)
 
#define GBL_CONTAINER_OF(ptr, type, member)
 
#define GBL_COUNT_OF(array)
 
#define GBL_PTR_OFFSET(...)
 
#define GBL_PTR_OFFSET_3(type, ptr, bytes)
 
#define GBL_PTR_OFFSET_2(ptr, bytes)
 
#define GBL_SWITCH_CASE_STRINGIFY(s)
 
#define GBL_LABEL_EMPTY(name)
 
#define GBL_SWAP(x, y)
 
#define GBL_ASSERT(...)
 
#define GBL_META_GENERIC_MACRO_GENERATE(traits, X)
 
#define GBL_META_GENERIC_MACRO_TRAIT_PROPERTY_DEFAULT(defaultFunc, overloads)
 
#define GBL_META_GENERIC_MACRO_NO_DEFAULT
 

Detailed Description

Miscellaneous macro utilities and meta generators.

See also
gimbal_macro_composition.h, gimbal_macro_sequences.h
Author
Falco Girgis

Definition in file gimbal_macro_utils.h.

Macro Definition Documentation

◆ GBL_MIN

#define GBL_MIN (   a,
 
)

Definition at line 22 of file gimbal_macro_utils.h.

◆ GBL_MAX

#define GBL_MAX (   a,
 
)

Definition at line 23 of file gimbal_macro_utils.h.

◆ GBL_CEIL

#define GBL_CEIL (   numerator,
  denominator 
)

Definition at line 24 of file gimbal_macro_utils.h.

◆ GBL_CLAMP

#define GBL_CLAMP (   n,
  min,
  max 
)

Definition at line 25 of file gimbal_macro_utils.h.

◆ GBL_BIT_MASK_2

#define GBL_BIT_MASK_2 (   bits,
  offset 
)

Definition at line 27 of file gimbal_macro_utils.h.

◆ GBL_BIT_MASK_1

#define GBL_BIT_MASK_1 (   bits)

Definition at line 28 of file gimbal_macro_utils.h.

◆ GBL_BIT_MASK

#define GBL_BIT_MASK (   ...)

Definition at line 29 of file gimbal_macro_utils.h.

◆ GBL_BCD_BYTE_PACK

#define GBL_BCD_BYTE_PACK (   n)

Definition at line 31 of file gimbal_macro_utils.h.

◆ GBL_BCD_BYTE_UNPACK

#define GBL_BCD_BYTE_UNPACK (   n)

Definition at line 32 of file gimbal_macro_utils.h.

◆ GBL_CONTAINER_OF

#define GBL_CONTAINER_OF (   ptr,
  type,
  member 
)

Definition at line 34 of file gimbal_macro_utils.h.

◆ GBL_COUNT_OF

#define GBL_COUNT_OF (   array)

Definition at line 35 of file gimbal_macro_utils.h.

◆ GBL_PTR_OFFSET

#define GBL_PTR_OFFSET (   ...)

Definition at line 37 of file gimbal_macro_utils.h.

◆ GBL_PTR_OFFSET_3

#define GBL_PTR_OFFSET_3 (   type,
  ptr,
  bytes 
)

Definition at line 38 of file gimbal_macro_utils.h.

◆ GBL_PTR_OFFSET_2

#define GBL_PTR_OFFSET_2 (   ptr,
  bytes 
)

Definition at line 39 of file gimbal_macro_utils.h.

◆ GBL_SWITCH_CASE_STRINGIFY

#define GBL_SWITCH_CASE_STRINGIFY (   s)

Definition at line 41 of file gimbal_macro_utils.h.

◆ GBL_LABEL_EMPTY

#define GBL_LABEL_EMPTY (   name)

Definition at line 43 of file gimbal_macro_utils.h.

◆ GBL_SWAP

#define GBL_SWAP (   x,
 
)

Definition at line 45 of file gimbal_macro_utils.h.

46 { \
47 unsigned char swap_temp[sizeof(x) == sizeof(y) ? \
48 (signed)sizeof(x) : -1]; \
49 memcpy(swap_temp, &y, sizeof(x)); \
50 memcpy(&y, &x, sizeof(x)); \
51 memcpy(&x, swap_temp, sizeof(x)); \
52 } GBL_STMT_END

◆ GBL_ASSERT

#define GBL_ASSERT (   ...)

Definition at line 54 of file gimbal_macro_utils.h.

◆ GBL_META_GENERIC_MACRO_GENERATE

#define GBL_META_GENERIC_MACRO_GENERATE (   traits,
 
)

Definition at line 60 of file gimbal_macro_utils.h.

64 : GBL_EVAL(GBL_META_GENERIC_MACRO_TRAIT_PROPERTY_DEFAULT traits) \
65 )

◆ GBL_META_GENERIC_MACRO_TRAIT_PROPERTY_DEFAULT

#define GBL_META_GENERIC_MACRO_TRAIT_PROPERTY_DEFAULT (   defaultFunc,
  overloads 
)

Definition at line 79 of file gimbal_macro_utils.h.

◆ GBL_META_GENERIC_MACRO_NO_DEFAULT

#define GBL_META_GENERIC_MACRO_NO_DEFAULT

Definition at line 80 of file gimbal_macro_utils.h.