add macro for word alignment setting
This commit is contained in:
@ -89,7 +89,7 @@ void* LinkedListAllocator::alloc(unsigned int req_size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Round to word borders
|
// Round to word borders
|
||||||
unsigned int req_size_diff = (4 - req_size % 4) % 4;
|
unsigned int req_size_diff = (BASIC_ALIGN - req_size % BASIC_ALIGN) % BASIC_ALIGN;
|
||||||
unsigned int rreq_size = req_size + req_size_diff;
|
unsigned int rreq_size = req_size + req_size_diff;
|
||||||
if (req_size_diff > 0) {
|
if (req_size_diff > 0) {
|
||||||
kout << " - Rounded to word border (+" << dec << req_size_diff << " bytes)" << endl;
|
kout << " - Rounded to word border (+" << dec << req_size_diff << " bytes)" << endl;
|
||||||
|
|||||||
@ -14,6 +14,9 @@
|
|||||||
|
|
||||||
#include "kernel/Allocator.h"
|
#include "kernel/Allocator.h"
|
||||||
|
|
||||||
|
// TODO: Is it 8 or 4?
|
||||||
|
#define BASIC_ALIGN 8
|
||||||
|
|
||||||
// Format eines freien Blocks, 4 + 4 + 4 Byte
|
// Format eines freien Blocks, 4 + 4 + 4 Byte
|
||||||
typedef struct free_block {
|
typedef struct free_block {
|
||||||
bool allocated; // NOTE: I added this to allow easier merging of free blocks:
|
bool allocated; // NOTE: I added this to allow easier merging of free blocks:
|
||||||
|
|||||||
Reference in New Issue
Block a user