changeset 764:c86488f7f319 libavutil

Introduce av_clip_uint16().
author ramiro
date Thu, 13 Aug 2009 18:47:13 +0000
parents cd95821e8278
children 2d52bcf3e4e6
files common.h
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/common.h	Mon Aug 10 13:42:16 2009 +0000
+++ b/common.h	Thu Aug 13 18:47:13 2009 +0000
@@ -190,6 +190,17 @@
 }
 
 /**
+ * Clips a signed integer value into the 0-65535 range.
+ * @param a value to clip
+ * @return clipped value
+ */
+static inline av_const uint16_t av_clip_uint16(int a)
+{
+    if (a&(~65535)) return (-a)>>31;
+    else            return a;
+}
+
+/**
  * Clips a signed integer value into the -32768,32767 range.
  * @param a value to clip
  * @return clipped value