[FFmpeg-cvslog] mem: minor simplification of the alignment hack code

Michael Niedermayer git at videolan.org
Fri Dec 14 06:01:37 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Dec 14 05:36:22 2012 +0100| [58f30175e1ed30aa8a3521d5b3a1ae700e5c5d23] | committer: Michael Niedermayer

mem: minor simplification of the alignment hack code

Idea-by: wanzhang
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=58f30175e1ed30aa8a3521d5b3a1ae700e5c5d23
---

 libavutil/mem.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/mem.c b/libavutil/mem.c
index 4253740..250b5f7 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



More information about the ffmpeg-cvslog mailing list