aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mathops.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-09-19 11:47:32 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-09-19 11:47:40 +0200
commitac2fc63ac6f938a4c995d87486013baffb5ca18a (patch)
treec338b18e8fbbc552683ac836877fd512656ca1de /libavcodec/mathops.h
parentfbd54827b1be23c1a234210df5cc876665fbd941 (diff)
parent9ae53c5860e17d087642d27b00dade071970a2e7 (diff)
downloadffmpeg-ac2fc63ac6f938a4c995d87486013baffb5ca18a.tar.gz
Merge commit '9ae53c5860e17d087642d27b00dade071970a2e7'
* commit '9ae53c5860e17d087642d27b00dade071970a2e7': lavc: add ff_u8_to_s8() for safe type punning of uint8_t to int8_t Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mathops.h')
-rw-r--r--libavcodec/mathops.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h
index 1d573424f4..bad25afd45 100644
--- a/libavcodec/mathops.h
+++ b/libavcodec/mathops.h
@@ -224,4 +224,14 @@ static inline av_const unsigned int ff_sqrt(unsigned int a)
return b - (a < b * b);
}
+static inline int8_t ff_u8_to_s8(uint8_t a)
+{
+ union {
+ uint8_t u8;
+ int8_t s8;
+ } b;
+ b.u8 = a;
+ return b.s8;
+}
+
#endif /* AVCODEC_MATHOPS_H */