FD.io VPP
v16.06
Vector Packet Processing
|
Vector bootsrap header file. More...
Go to the source code of this file.
Data Structures | |
struct | vec_header_t |
vector header structure More... | |
Macros | |
#define | vec_len(v) ((v) ? _vec_len(v) : 0) |
Number of elements in vector (rvalue-only, NULL tolerant) More... | |
#define | vec_reset_length(v) do { if (v) _vec_len (v) = 0; } while (0) |
Reset vector length to zero NULL-pointer tolerant. More... | |
#define | vec_bytes(v) (vec_len (v) * sizeof (v[0])) |
Number of data bytes in vector. More... | |
#define | vec_capacity(v, b) |
Total number of bytes that can fit in vector with current allocation. More... | |
#define | vec_max_len(v) (vec_capacity(v,0) / sizeof (v[0])) |
Total number of elements that can fit into vector. More... | |
#define | vec_end(v) ((v) + vec_len (v)) |
End (last data address) of vector. More... | |
#define | vec_is_member(v, e) ((e) >= (v) && (e) < vec_end (v)) |
True if given pointer is within given vector. More... | |
#define | vec_elt_at_index(v, i) |
Get vector value at index i checking that i is in bounds. More... | |
#define | vec_elt(v, i) (vec_elt_at_index(v,i))[0] |
Get vector value at index i. More... | |
#define | vec_foreach(var, vec) for (var = (vec); var < vec_end (vec); var++) |
Vector iterator. More... | |
#define | vec_foreach_backwards(var, vec) for (var = vec_end (vec) - 1; var >= (vec); var--) |
Vector iterator (reverse) More... | |
#define | vec_foreach_index(var, v) for ((var) = 0; (var) < vec_len (v); (var)++) |
Iterate over vector indices. More... | |
Functions | |
always_inline uword | vec_header_bytes (uword header_bytes) |
always_inline void * | vec_header (void *v, uword header_bytes) |
Find a user vector header. More... | |
always_inline void * | vec_header_end (void *v, uword header_bytes) |
Find the end of user vector header. More... | |
always_inline uword | vec_aligned_header_bytes (uword header_bytes, uword align) |
always_inline void * | vec_aligned_header (void *v, uword header_bytes, uword align) |
always_inline void * | vec_aligned_header_end (void *v, uword header_bytes, uword align) |
Vector bootsrap header file.
Definition in file vec_bootstrap.h.
#define vec_bytes | ( | v | ) | (vec_len (v) * sizeof (v[0])) |
Number of data bytes in vector.
Definition at line 140 of file vec_bootstrap.h.
#define vec_capacity | ( | v, | |
b | |||
) |
Total number of bytes that can fit in vector with current allocation.
Definition at line 144 of file vec_bootstrap.h.
#define vec_elt | ( | v, | |
i | |||
) | (vec_elt_at_index(v,i))[0] |
Get vector value at index i.
Definition at line 169 of file vec_bootstrap.h.
#define vec_elt_at_index | ( | v, | |
i | |||
) |
Get vector value at index i checking that i is in bounds.
Definition at line 162 of file vec_bootstrap.h.
#define vec_end | ( | v | ) | ((v) + vec_len (v)) |
End (last data address) of vector.
Definition at line 156 of file vec_bootstrap.h.
#define vec_foreach | ( | var, | |
vec | |||
) | for (var = (vec); var < vec_end (vec); var++) |
Vector iterator.
Definition at line 172 of file vec_bootstrap.h.
#define vec_foreach_backwards | ( | var, | |
vec | |||
) | for (var = vec_end (vec) - 1; var >= (vec); var--) |
Vector iterator (reverse)
Definition at line 175 of file vec_bootstrap.h.
#define vec_foreach_index | ( | var, | |
v | |||
) | for ((var) = 0; (var) < vec_len (v); (var)++) |
Iterate over vector indices.
Definition at line 179 of file vec_bootstrap.h.
#define vec_is_member | ( | v, | |
e | |||
) | ((e) >= (v) && (e) < vec_end (v)) |
True if given pointer is within given vector.
Definition at line 159 of file vec_bootstrap.h.
#define vec_len | ( | v | ) | ((v) ? _vec_len(v) : 0) |
Number of elements in vector (rvalue-only, NULL tolerant)
vec_len (v) checks for NULL, but cannot be used as an lvalue. If in doubt, use vec_len...
Definition at line 130 of file vec_bootstrap.h.
#define vec_max_len | ( | v | ) | (vec_capacity(v,0) / sizeof (v[0])) |
Total number of elements that can fit into vector.
Definition at line 153 of file vec_bootstrap.h.
#define vec_reset_length | ( | v | ) | do { if (v) _vec_len (v) = 0; } while (0) |
Reset vector length to zero NULL-pointer tolerant.
Definition at line 136 of file vec_bootstrap.h.
always_inline void* vec_aligned_header | ( | void * | v, |
uword | header_bytes, | ||
uword | align | ||
) |
Definition at line 108 of file vec_bootstrap.h.
always_inline uword vec_aligned_header_bytes | ( | uword | header_bytes, |
uword | align | ||
) |
Definition at line 102 of file vec_bootstrap.h.
always_inline void* vec_aligned_header_end | ( | void * | v, |
uword | header_bytes, | ||
uword | align | ||
) |
Definition at line 112 of file vec_bootstrap.h.
always_inline void* vec_header | ( | void * | v, |
uword | header_bytes | ||
) |
Find a user vector header.
Finds the user header of a vector with unspecified alignment given the user pointer to the vector.
Definition at line 88 of file vec_bootstrap.h.
always_inline uword vec_header_bytes | ( | uword | header_bytes | ) |
Definition at line 78 of file vec_bootstrap.h.
always_inline void* vec_header_end | ( | void * | v, |
uword | header_bytes | ||
) |
Find the end of user vector header.
Finds the end of the user header of a vector with unspecified alignment given the user pointer to the vector.
Definition at line 98 of file vec_bootstrap.h.