]> mj.ucw.cz Git - netgrind.git/blobdiff - lib/pools.h
TODO: A note on IPv6
[netgrind.git] / lib / pools.h
index a055ef2623763f2da93ca77632ca60d168df9c7d..6c40ef0497ccb719ee28593ae234906abef90960 100644 (file)
@@ -14,6 +14,8 @@
 #define POOL_ALIGN CPU_STRUCT_ALIGN
 #endif
 
+#include <stdint.h>
+
 struct mempool {
   byte *free, *last;
   struct memchunk *first, *current, **plast;
@@ -29,7 +31,7 @@ void *mp_alloc_zero(struct mempool *, uns);
 
 static inline void *mp_alloc_fast(struct mempool *p, uns l)
 {
-  byte *f = (void *) (((uns) p->free + POOL_ALIGN - 1) & ~(POOL_ALIGN - 1));
+  byte *f = (void *) (((uintptr_t) p->free + POOL_ALIGN - 1) & ~((uintptr_t) POOL_ALIGN - 1));
   byte *ee = f + l;
   if (ee > p->last)
     return mp_alloc(p, l);