From dda03514719e0e9b3fb570d767575dbd3728c0f2 Mon Sep 17 00:00:00 2001 From: Mark VanderVoord Date: Mon, 6 Feb 2017 07:04:22 -0500 Subject: [PATCH] Make smarter guesses about memory alignment based on the size of long discovered by unity --- src/cmock_internals.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/cmock_internals.h b/src/cmock_internals.h index 1100171..3eaf9a3 100644 --- a/src/cmock_internals.h +++ b/src/cmock_internals.h @@ -59,7 +59,19 @@ extern const char* CMockStringMismatch; //0 for no alignment, 1 for 16-bit, 2 for 32-bit, 3 for 64-bit #ifndef CMOCK_MEM_ALIGN -#define CMOCK_MEM_ALIGN (2) + #ifdef UNITY_LONG_WIDTH + #if (UNITY_LONG_WIDTH == 16) + #define CMOCK_MEM_ALIGN (1) + #elif (UNITY_LONG_WIDTH == 32) + #define CMOCK_MEM_ALIGN (2) + #elif (UNITY_LONG_WIDTH == 64) + #define CMOCK_MEM_ALIGN (3) + #else + #define CMOCK_MEM_ALIGN (2) + #endif + #else + #define CMOCK_MEM_ALIGN (2) + #endif #endif //amount of memory to allow cmock to use in its internal heap