From: Vsevolod Stakhov Date: Mon, 23 Dec 2019 15:54:05 +0000 (+0000) Subject: [Minor] Improve align_ptr macro X-Git-Tag: 2.3~187 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=06b703488213c534f3430a03cd60952254e6b661;p=rspamd.git [Minor] Improve align_ptr macro --- diff --git a/src/libutil/mem_pool_internal.h b/src/libutil/mem_pool_internal.h index 9341fce08..e7a5ecaf2 100644 --- a/src/libutil/mem_pool_internal.h +++ b/src/libutil/mem_pool_internal.h @@ -22,7 +22,7 @@ */ #define align_ptr(p, a) \ - (guint8 *) (((uintptr_t) (p) + ((uintptr_t) a - 1)) & ~((uintptr_t) a - 1)) + ((guint8 *) ((uintptr_t) (p) + ((-(intptr_t)(p)) & ((a) - 1)))) enum rspamd_mempool_chain_type { RSPAMD_MEMPOOL_NORMAL = 0,