/*
* The UCW Library -- Miscellaneous Functions
*
- * (c) 1997--2004 Martin Mares <mj@ucw.cz>
+ * (c) 1997--2005 Martin Mares <mj@ucw.cz>
* (c) 2005 Tomas Valla <tom@ucw.cz>
*
* This software may be freely distributed and used according to the terms
#define SKIP_BACK(s, i, p) ((s *)((char *)p - OFFSETOF(s, i)))
#define ALIGN(s, a) (((s)+a-1)&~(a-1))
#define ALIGN_PTR(p, s) ((addr_int_t)(p) % (s) ? (typeof(p))((addr_int_t)(p) + (s) - (addr_int_t)(p) % (s)) : (p))
-#define UNALIGNED_PART(ptr, type) (((long) (ptr)) % sizeof(type))
+#define UNALIGNED_PART(ptr, type) (((addr_int_t) (ptr)) % sizeof(type))
/* Some other macros */
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 *) (((addr_int_t) p->free + POOL_ALIGN - 1) & ~(addr_int_t)(POOL_ALIGN - 1));
byte *ee = f + l;
if (ee > p->last)
return mp_alloc(p, l);