You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/03/31 11:44:04 UTC
[incubator-nuttx] branch master updated: mm/mm_heap: place alloc-bit at the LSB of node->preceeding.
This is an automated email from the ASF dual-hosted git repository.
pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new a0bde21 mm/mm_heap: place alloc-bit at the LSB of node->preceeding.
a0bde21 is described below
commit a0bde21f0f2b8694cf3f60efe1e665dc15c340e5
Author: wangbowen6 <wa...@xiaomi.com>
AuthorDate: Wed Mar 30 20:31:29 2022 +0800
mm/mm_heap: place alloc-bit at the LSB of node->preceeding.
Heap always allocate the memory at least 2bytes alignment.
Signed-off-by: wangbowen6 <wa...@xiaomi.com>
---
mm/mm_heap/mm.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/mm/mm_heap/mm.h b/mm/mm_heap/mm.h
index af89268..9ea235e 100644
--- a/mm/mm_heap/mm.h
+++ b/mm/mm_heap/mm.h
@@ -124,15 +124,14 @@
#define MM_ALIGN_UP(a) (((a) + MM_GRAN_MASK) & ~MM_GRAN_MASK)
#define MM_ALIGN_DOWN(a) ((a) & ~MM_GRAN_MASK)
-/* An allocated chunk is distinguished from a free chunk by bit 31 (or 15)
+/* An allocated chunk is distinguished from a free chunk by bit 0
* of the 'preceding' chunk size. If set, then this is an allocated chunk.
*/
+#define MM_ALLOC_BIT 0x1
#ifdef CONFIG_MM_SMALL
-# define MM_ALLOC_BIT 0x8000
# define MMSIZE_MAX UINT16_MAX
#else
-# define MM_ALLOC_BIT 0x80000000
# define MMSIZE_MAX UINT32_MAX
#endif