diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-09-19 11:47:32 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-09-19 11:47:40 +0200 |
commit | ac2fc63ac6f938a4c995d87486013baffb5ca18a (patch) | |
tree | c338b18e8fbbc552683ac836877fd512656ca1de /libavcodec/mathops.h | |
parent | fbd54827b1be23c1a234210df5cc876665fbd941 (diff) | |
parent | 9ae53c5860e17d087642d27b00dade071970a2e7 (diff) | |
download | ffmpeg-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.h | 10 |
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 */ |