diff --git a/libavutil/mem.c b/libavutil/mem.c index 4253740a10..250b5f745e 100644 --- a/libavutil/mem.c +++ b/libavutil/mem.c @@ -84,7 +84,7 @@ void *av_malloc(size_t size) ptr = malloc(size + ALIGN); if (!ptr) return ptr; - diff = ((-(long)ptr - 1)&(ALIGN - 1)) + 1; + diff = ((~(long)ptr)&(ALIGN - 1)) + 1; ptr = (char *)ptr + diff; ((char *)ptr)[-1] = diff; #elif HAVE_POSIX_MEMALIGN