[dpdk-dev] [PATCH v2 05/10] eal: add and use unaligned integer types

Thomas Monjalon thomas.monjalon at 6wind.com
Mon Jun 22 11:36:20 CEST 2015


2015-06-19 10:34, Cyril Chemparathy:
> On machines that are strict on pointer alignment, current code breaks
> on GCC's -Wcast-align checks on casts from narrower to wider types.
> This patch introduces new unaligned_uint(16|32|64)_t types, which
> correctly retain alignment in such cases.
[...]
> +#ifdef RTE_ARCH_STRICT_ALIGN
> +typedef uint64_t unaligned_uint64_t __attribute__ ((aligned(1)));
> +typedef uint32_t unaligned_uint32_t __attribute__ ((aligned(1)));
> +typedef uint16_t unaligned_uint16_t __attribute__ ((aligned(1)));
> +#else
> +typedef uint64_t unaligned_uint64_t;
> +typedef uint32_t unaligned_uint32_t;
> +typedef uint16_t unaligned_uint16_t;
> +#endif

CONFIG_RTE_ARCH_STRICT_ALIGN should be declared (and disabled) in config templates.


More information about the dev mailing list