clang-format alignment rules
This commit is contained in:
@@ -46,11 +46,11 @@ int liballoc_free (void* ptr, int pages) {
|
||||
//#define DEBUG
|
||||
|
||||
#define LIBALLOC_MAGIC 0xc001c0de
|
||||
#define MAXCOMPLETE 5
|
||||
#define MAXEXP 32
|
||||
#define MINEXP 8
|
||||
#define MAXCOMPLETE 5
|
||||
#define MAXEXP 32
|
||||
#define MINEXP 8
|
||||
|
||||
#define MODE_BEST 0
|
||||
#define MODE_BEST 0
|
||||
#define MODE_INSTANT 1
|
||||
|
||||
#define MODE MODE_BEST
|
||||
@@ -95,7 +95,7 @@ static inline int getexp (unsigned int size) {
|
||||
|
||||
#ifdef DEBUG
|
||||
printf ("getexp returns %i (%i bytes) for %i size\n", shift - 1,
|
||||
(1 << (shift - 1)), size);
|
||||
(1 << (shift - 1)), size);
|
||||
#endif
|
||||
|
||||
return shift - 1;
|
||||
@@ -226,8 +226,9 @@ static inline struct boundary_tag* split_tag (struct boundary_tag* tag) {
|
||||
unsigned int remainder =
|
||||
tag->real_size - sizeof (struct boundary_tag) - tag->size;
|
||||
|
||||
struct boundary_tag* new_tag = (struct boundary_tag*)((uintptr_t)tag +
|
||||
sizeof (struct boundary_tag) + tag->size);
|
||||
struct boundary_tag* new_tag =
|
||||
(struct boundary_tag*)((uintptr_t)tag + sizeof (struct boundary_tag) +
|
||||
tag->size);
|
||||
|
||||
new_tag->magic = LIBALLOC_MAGIC;
|
||||
new_tag->real_size = remainder;
|
||||
@@ -285,7 +286,7 @@ static struct boundary_tag* allocate_new_tag (unsigned int size) {
|
||||
|
||||
#ifdef DEBUG
|
||||
printf ("Resource allocated %x of %i pages (%i bytes) for %i size.\n", tag,
|
||||
pages, pages * l_pageSize, size);
|
||||
pages, pages * l_pageSize, size);
|
||||
|
||||
l_allocated += pages * l_pageSize;
|
||||
|
||||
@@ -325,8 +326,8 @@ void* malloc (size_t size) {
|
||||
(size + sizeof (struct boundary_tag))) {
|
||||
#ifdef DEBUG
|
||||
printf ("Tag search found %i >= %i\n",
|
||||
(tag->real_size - sizeof (struct boundary_tag)),
|
||||
(size + sizeof (struct boundary_tag)));
|
||||
(tag->real_size - sizeof (struct boundary_tag)),
|
||||
(size + sizeof (struct boundary_tag)));
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -366,13 +367,13 @@ void* malloc (size_t size) {
|
||||
sizeof (struct boundary_tag) * 2; // Support a new tag + remainder
|
||||
|
||||
if (((int)(remainder) >
|
||||
0) /*&& ( (tag->real_size - remainder) >= (1<<MINEXP))*/) {
|
||||
0) /*&& ( (tag->real_size - remainder) >= (1<<MINEXP))*/) {
|
||||
int childIndex = getexp (remainder);
|
||||
|
||||
if (childIndex >= 0) {
|
||||
#ifdef DEBUG
|
||||
printf ("Seems to be splittable: %i >= 2^%i .. %i\n", remainder,
|
||||
childIndex, (1 << childIndex));
|
||||
childIndex, (1 << childIndex));
|
||||
#endif
|
||||
|
||||
struct boundary_tag* new_tag = split_tag (tag);
|
||||
@@ -381,7 +382,7 @@ void* malloc (size_t size) {
|
||||
|
||||
#ifdef DEBUG
|
||||
printf ("Old tag has become %i bytes, new tag is now %i bytes (%i exp)\n",
|
||||
tag->real_size, new_tag->real_size, new_tag->index);
|
||||
tag->real_size, new_tag->real_size, new_tag->index);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -391,7 +392,7 @@ void* malloc (size_t size) {
|
||||
#ifdef DEBUG
|
||||
l_inuse += size;
|
||||
printf ("malloc: %x, %i, %i\n", ptr, (int)l_inuse / 1024,
|
||||
(int)l_allocated / 1024);
|
||||
(int)l_allocated / 1024);
|
||||
dump_array ();
|
||||
#endif
|
||||
|
||||
@@ -417,8 +418,8 @@ void free (void* ptr) {
|
||||
|
||||
#ifdef DEBUG
|
||||
l_inuse -= tag->size;
|
||||
printf (
|
||||
"free: %x, %i, %i\n", ptr, (int)l_inuse / 1024, (int)l_allocated / 1024);
|
||||
printf ("free: %x, %i, %i\n", ptr, (int)l_inuse / 1024,
|
||||
(int)l_allocated / 1024);
|
||||
#endif
|
||||
|
||||
// MELT LEFT...
|
||||
|
||||
Reference in New Issue
Block a user