summaryrefslogtreecommitdiff
path: root/com32
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2006-01-19 09:02:46 -0800
committerH. Peter Anvin <hpa@zytor.com>2006-01-19 09:02:46 -0800
commitf1d29748a432327bc891cf9c87144070318d479e (patch)
tree766c33288aa7c442b8d16340627384c43ae84b28 /com32
parent338537160ab79aa5b88472ffa28d4c8cf6179706 (diff)
downloadsyslinux-f1d29748a432327bc891cf9c87144070318d479e.tar.gz
Invert the sense of ARENA_SIZE_MASK to be consistent with klibc
Diffstat (limited to 'com32')
-rw-r--r--com32/lib/malloc.c2
-rw-r--r--com32/lib/malloc.h6
-rw-r--r--com32/lib/realloc.c2
3 files changed, 5 insertions, 5 deletions
diff --git a/com32/lib/malloc.c b/com32/lib/malloc.c
index 8f6d97d6..e7a1cdc9 100644
--- a/com32/lib/malloc.c
+++ b/com32/lib/malloc.c
@@ -105,7 +105,7 @@ void *malloc(size_t size)
return NULL;
/* Add the obligatory arena header, and round up */
- size = (size+2*sizeof(struct arena_header)-1) & ~ARENA_SIZE_MASK;
+ size = (size+2*sizeof(struct arena_header)-1) & ARENA_SIZE_MASK;
for ( fp = __malloc_head.next_free ; fp->a.type != ARENA_TYPE_HEAD ;
fp = fp->next_free ) {
diff --git a/com32/lib/malloc.h b/com32/lib/malloc.h
index 70d0e635..830377d9 100644
--- a/com32/lib/malloc.h
+++ b/com32/lib/malloc.h
@@ -37,10 +37,10 @@ struct arena_header {
#define ARENA_TYPE_HEAD 2
#endif
-#define ARENA_SIZE_MASK (sizeof(struct arena_header)-1)
+#define ARENA_SIZE_MASK (~(uintptr_t)(sizeof(struct arena_header)-1))
-#define ARENA_ALIGN_UP(p) ((char *)(((uintptr_t)(p) + ARENA_SIZE_MASK) & ~ARENA_SIZE_MASK))
-#define ARENA_ALIGN_DOWN(p) ((char *)((uintptr_t)(p) & ~ARENA_SIZE_MASK))
+#define ARENA_ALIGN_UP(p) ((char *)(((uintptr_t)(p) + ~ARENA_SIZE_MASK) & ARENA_SIZE_MASK))
+#define ARENA_ALIGN_DOWN(p) ((char *)((uintptr_t)(p) & ARENA_SIZE_MASK))
/*
* This structure should be no more than twice the size of the
diff --git a/com32/lib/realloc.c b/com32/lib/realloc.c
index 67a27834..577c2001 100644
--- a/com32/lib/realloc.c
+++ b/com32/lib/realloc.c
@@ -24,7 +24,7 @@ void *realloc(void *ptr, size_t size)
}
/* Add the obligatory arena header, and round up */
- size = (size+2*sizeof(struct arena_header)-1) & ~ARENA_SIZE_MASK;
+ size = (size+2*sizeof(struct arena_header)-1) & ARENA_SIZE_MASK;
ah = (struct free_arena_header *)
((struct arena_header *)ptr - 1);