lib: os: cbprintf_packaged: update alignment for x86-32
The size of long double on x86-32 is 12 which is not
a power of 2, and this results in build error when it is
being used for alignment of buf32 in log_core.c.
So manually set it to 16.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
diff --git a/include/sys/cbprintf.h b/include/sys/cbprintf.h
index 64a6fc7..e366829 100644
--- a/include/sys/cbprintf.h
+++ b/include/sys/cbprintf.h
@@ -47,6 +47,13 @@
/** @brief Required alignment of the buffer used for packaging. */
#ifdef __xtensa__
#define CBPRINTF_PACKAGE_ALIGNMENT 16
+#elif defined(CONFIG_X86) && !defined(CONFIG_64BIT)
+/* sizeof(long double) is 12 on x86-32, which is not power of 2.
+ * So set it manually.
+ */
+#define CBPRINTF_PACKAGE_ALIGNMENT \
+ (IS_ENABLED(CONFIG_CBPRINTF_PACKAGE_LONGDOUBLE) ? \
+ 16 : MAX(sizeof(double), sizeof(long long)))
#else
#define CBPRINTF_PACKAGE_ALIGNMENT \
(IS_ENABLED(CONFIG_CBPRINTF_PACKAGE_LONGDOUBLE) ? \