Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
---
 libavutil/common.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavutil/common.h b/libavutil/common.h
index b9fbcc4d60..a60a558b1d 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -80,6 +80,14 @@
  */
 #define FFNABS(a) ((a) <= 0 ? (a) : (-(a)))
 
+/**
+ * Unsigned Absolute value.
+ * This takes the absolute value of a signed int and returns it as a unsigned.
+ * This also works with INT_MIN which would otherwise not be representable
+ * As with many macros, this evaluates its argument twice.
+ */
+#define FFABSU(a) ((a) <= 0 ? -(unsigned)(a) : (unsigned)(a))
+
 /**
  * Comparator.
  * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0
-- 
2.17.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to