MT#55283 move alignment macros to header file

Change-Id: I266cbefe8351f77399bb6e50b2122f9a45249529
pull/1923/head
Richard Fuchs 1 month ago
parent 1a98502a1b
commit 5f9e43b3e0

@ -3,8 +3,6 @@
#include <stdbool.h>
#include "obj.h"
#define ALIGN 8 // bytes
struct bufferpool {
void *(*alloc)(size_t);
void (*dealloc)(void *);
@ -154,7 +152,7 @@ void *bufferpool_alloc(struct bufferpool *bp, size_t len) {
void *ret = shard->head;
shard->refs++;
shard->head += ((len + ALIGN - 1) / ALIGN) * ALIGN;
shard->head += BUFFERPOOL_ALIGN(len);
return ret;
}

@ -3,6 +3,9 @@
#include "obj.h"
#define BUFFERPOOL_ALIGNMENT (sizeof(void *)) // bytes
#define BUFFERPOOL_ALIGN(x) (((x + BUFFERPOOL_ALIGNMENT - 1) / BUFFERPOOL_ALIGNMENT) * BUFFERPOOL_ALIGNMENT)
struct bufferpool;
struct bpool_shard;

Loading…
Cancel
Save