diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-02-24 14:57:38 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-02-24 14:57:38 +0000 |
commit | 24594525990ee1769ee933261b821211b4c299e8 (patch) | |
tree | 78fadffd9ad2173941eff2d7a096d593a9e0f15e /os/kernel/include | |
parent | a55d3c6e6b8d14d6310382f149593df231925c17 (diff) | |
download | ChibiOS-24594525990ee1769ee933261b821211b4c299e8.tar.gz ChibiOS-24594525990ee1769ee933261b821211b4c299e8.tar.bz2 ChibiOS-24594525990ee1769ee933261b821211b4c299e8.zip |
Fixed bugs 3191107 and 3191112.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2762 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/kernel/include')
-rw-r--r-- | os/kernel/include/chmemcore.h | 14 | ||||
-rw-r--r-- | os/kernel/include/chmempools.h | 2 |
2 files changed, 13 insertions, 3 deletions
diff --git a/os/kernel/include/chmemcore.h b/os/kernel/include/chmemcore.h index f42478125..58cb318b2 100644 --- a/os/kernel/include/chmemcore.h +++ b/os/kernel/include/chmemcore.h @@ -36,14 +36,24 @@ typedef void *(*memgetfunc_t)(size_t size);
/**
+ * @brief Alignment size constant.
+ */
+#define MEM_ALIGN_SIZE sizeof(stkalign_t)
+
+/**
* @brief Alignment mask constant.
*/
-#define MEM_ALIGN_MASK (sizeof(stkalign_t) - 1)
+#define MEM_ALIGN_MASK (MEM_ALIGN_SIZE - 1)
+
+/**
+ * @brief Alignment helper macro.
+ */
+#define MEM_ALIGN_PREV(p) ((size_t)(p) & ~MEM_ALIGN_MASK)
/**
* @brief Alignment helper macro.
*/
-#define MEM_ALIGN_SIZE(p) (((size_t)(p) + MEM_ALIGN_MASK) & ~MEM_ALIGN_MASK)
+#define MEM_ALIGN_NEXT(p) MEM_ALIGN_PREV((size_t)(p) + MEM_ALIGN_MASK)
/**
* @brief Returns whatever a pointer or memory size is aligned to
diff --git a/os/kernel/include/chmempools.h b/os/kernel/include/chmempools.h index 1c2e2aa70..9dbe332c8 100644 --- a/os/kernel/include/chmempools.h +++ b/os/kernel/include/chmempools.h @@ -59,7 +59,7 @@ typedef struct { * @param[in] provider memory provider function for the memory pool
*/
#define _MEMORYPOOL_DATA(name, size, provider) \
- {NULL, MEM_ALIGN_SIZE(size), provider}
+ {NULL, MEM_ALIGN_NEXT(size), provider}
/**
* @brief Static memory pool initializer in hungry mode.
|