Function ds_elt_space_simple

Function Documentation

static inline size_t ds_elt_space_simple(size_t max_elts, size_t elt_size)

Calculate how large the chunk of memory for some “element” that a data structure will manage needs to be, given a max # of elements and element size. “Element” can refer to the nodes needed by some data structures, or the actual elements the data structure will manage.

For data structures that do NOT require metadata (FIFOs, ringbuffers, etc.).

You really shouldn’t use this function—use the specific calculation functions for each data structure found in their respective header files. Used in conjunction with RCSW_NOALLOC_DATA.

Parameters:
  • max_elts – Max # elements the structure will manage

  • elt_size – Size of each element in bytes

Returns:

Total # of bytes required