cdcontainers  0.1.1
Library of data containers and collections for C programming language.
Data Structures | Macros | Typedefs | Enumerations | Functions
common.h File Reference
#include <cdcontainers/casts.h>
#include <cdcontainers/hash.h>
#include <stdbool.h>
#include <stddef.h>

Go to the source code of this file.

Data Structures

struct  cdc_pair
 
struct  cdc_data_info
 The cdc_data_info struct used to initialize contaners. More...
 

Macros

#define CDC_END   CDC_FROM_INT(UINTPTR_MAX)
 
#define CDC_MAX(a, b)   ((a) > (b) ? (a) : (b))
 
#define CDC_MIN(a, b)   ((a) < (b) ? (a) : (b))
 
#define CDC_ABS(x)   ((x < 0) ? -(x) : x)
 
#define CDC_ARRAY_SIZE(x)   (sizeof(x) / sizeof(x[0]))
 
#define CDC_SWAP(T, x, y)
 
#define CDC_INIT_STRUCT
 
#define CDC_STATIC_ASSERT(COND, MSG)   typedef char cdc_static_assertion_##MSG[(COND) ? 1 : -1]
 

Typedefs

typedef void(* cdc_free_fn_t) (void *)
 
typedef int(* cdc_unary_pred_fn_t) (const void *)
 
typedef int(* cdc_binary_pred_fn_t) (const void *, const void *)
 
typedef void(* cdc_copy_fn_t) (void *, const void *)
 

Enumerations

enum  cdc_iterator_type { CDC_FWD_ITERATOR, CDC_BIDIR_ITERATOR, CDC_RA_ITERATOR }
 

Functions

static size_t cdc_up_to_pow2 (size_t x)
 

Macro Definition Documentation

◆ CDC_END

#define CDC_END   CDC_FROM_INT(UINTPTR_MAX)

◆ CDC_MAX

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

◆ CDC_MIN

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

◆ CDC_ABS

#define CDC_ABS (   x)    ((x < 0) ? -(x) : x)

◆ CDC_ARRAY_SIZE

#define CDC_ARRAY_SIZE (   x)    (sizeof(x) / sizeof(x[0]))

◆ CDC_SWAP

#define CDC_SWAP (   T,
  x,
 
)
Value:
do { \
T tmp = x; \
x = y; \
y = tmp; \
} while (0)

◆ CDC_INIT_STRUCT

#define CDC_INIT_STRUCT
Value:
{ \
0, \
}

◆ CDC_STATIC_ASSERT

#define CDC_STATIC_ASSERT (   COND,
  MSG 
)    typedef char cdc_static_assertion_##MSG[(COND) ? 1 : -1]

Typedef Documentation

◆ cdc_free_fn_t

typedef void(* cdc_free_fn_t) (void *)

◆ cdc_unary_pred_fn_t

typedef int(* cdc_unary_pred_fn_t) (const void *)

◆ cdc_binary_pred_fn_t

typedef int(* cdc_binary_pred_fn_t) (const void *, const void *)

◆ cdc_copy_fn_t

typedef void(* cdc_copy_fn_t) (void *, const void *)

Enumeration Type Documentation

◆ cdc_iterator_type

Enumerator
CDC_FWD_ITERATOR 
CDC_BIDIR_ITERATOR 
CDC_RA_ITERATOR 

Function Documentation

◆ cdc_up_to_pow2()

static size_t cdc_up_to_pow2 ( size_t  x)
inlinestatic