diff options
author | Dave Wallace <dwallacelf@gmail.com> | 2018-12-13 12:29:44 -0500 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2018-12-17 00:10:16 +0000 |
commit | 4659d0e82343e6c061261f0a2aa977b0d00f199d (patch) | |
tree | 2bb24ef2b0bf23e08537211743e71ac53dc361f6 /src/vppinfra/vec.h | |
parent | 4ee633e84af18e9237554df2015a332749dc358a (diff) |
docs: clarify vector element alignment description.
Change-Id: I6da153779010263e6fc4b51c64b01444aaadca17
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'src/vppinfra/vec.h')
-rw-r--r-- | src/vppinfra/vec.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/vppinfra/vec.h b/src/vppinfra/vec.h index 470a4f190c2..6f0e7e9148b 100644 --- a/src/vppinfra/vec.h +++ b/src/vppinfra/vec.h @@ -70,16 +70,18 @@ Typically, the header is not present. Headers allow for other data structures to be built atop CLIB vectors. - Users may specify the alignment for data elements via the - vec_*_aligned macros. + Users may specify the alignment for first data element of a vector + via the vec_*_aligned macros. - Vectors elements can be any C type e.g. (int, double, struct bar). + Vector elements can be any C type e.g. (int, double, struct bar). This is also true for data types built atop vectors (e.g. heap, pool, etc.). - Many macros have _a variants supporting alignment of vector data - and _h variants supporting non zero length vector headers. - The _ha variants support both. + Many macros have \_a variants supporting alignment of vector elements + and \_h variants supporting non-zero-length vector headers. The \_ha + variants support both. Additionally cacheline alignment within a + vector element structure can be specified using the + CLIB_CACHE_LINE_ALIGN_MARK() macro. Standard programming error: memorize a pointer to the ith element of a vector then expand it. Vectors expand by 3/2, so such code |