#pragma once
#include <stdint.h>
#include "stddef.h"
#include "slab.h"   // kmalloc/kfree now come from slab

#define ALIGN_DOWN(x, a)   ((x) & ~((a)-1))
#define ALIGN_UP(x, a)     (((x) + (a)-1) & ~((a)-1))
#define SIZEOF_ARRAY(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0]))

#define DIV_ROUNDUP(A, B)        \
	({                           \
		__auto_type _a_ = A;     \
		__auto_type _b_ = B;     \
		(_a_ + (_b_ - 1)) / _b_; \
	})


void *memcpy(void *restrict dest, const void *restrict src, size_t n);
void *memset(void *s, int c, size_t n);
int memcmp(const void *s1, const void *s2, size_t n); 
void *memmove(void *dest, const void *src, size_t n); 
#define memzero(a, b) memset(a, 0, b)



#define kmalloc  slab_alloc
#define kfree    slab_free
#define krealloc slab_realloc