1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-29 12:03:03 +00:00

- pctrie really only requires two byte alignment so that there is a single

bit available for a flag in the pointer.  However, it felt more correct
   to enforce natural alignment of the key pointer.  Unfortunately on
   32bit architectures 64bit integers are not always naturally aligned.
   Change the assert to enforce only 32bit alignment of the 64bit key for
   now to fix the build.  A more correct fix would be to properly sort
   the struct buf fields which definitely suffer from bloat due to padding.
This commit is contained in:
Jeff Roberson 2013-05-12 20:44:28 +00:00
parent 404eb1b3fd
commit 3825b1121b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=250578

View File

@ -38,7 +38,11 @@
#define PCTRIE_DEFINE(name, type, field, allocfn, freefn) \
\
CTASSERT(sizeof(((struct type *)0)->field) == sizeof(uint64_t)); \
CTASSERT((__offsetof(struct type, field) & (sizeof(uint64_t) - 1)) == 0); \
/* \
* XXX This assert protects flag bits, it does not enforce natural \
* alignment. 32bit architectures do not naturally align 64bit fields. \
*/ \
CTASSERT((__offsetof(struct type, field) & (sizeof(uint32_t) - 1)) == 0); \
\
static __inline struct type * \
name##_PCTRIE_VAL2PTR(uint64_t *val) \