mirror of
https://github.com/NekoX-Dev/NekoX.git
synced 2024-12-13 18:39:33 +01:00
32 lines
686 B
C
32 lines
686 B
C
#ifndef FFMPEG_MATHOPS_FIX_H
|
|
#define FFMPEG_MATHOPS_FIX_H
|
|
|
|
#ifndef NEG_USR32
|
|
# define NEG_USR32(a,s) (((uint32_t)(a))>>(32-(s)))
|
|
#endif
|
|
|
|
#ifndef NEG_SSR32
|
|
# define NEG_SSR32(a,s) ((( int32_t)(a))>>(32-(s)))
|
|
#endif
|
|
|
|
#ifndef sign_extend
|
|
static inline av_const int sign_extend(int val, unsigned bits)
|
|
{
|
|
unsigned shift = 8 * sizeof(int) - bits;
|
|
union { unsigned u; int s; } v = { (unsigned) val << shift };
|
|
return v.s >> shift;
|
|
}
|
|
#endif
|
|
|
|
#ifndef zero_extend
|
|
static inline av_const unsigned zero_extend(unsigned val, unsigned bits)
|
|
{
|
|
return (val << ((8 * sizeof(int)) - bits)) >> ((8 * sizeof(int)) - bits);
|
|
}
|
|
#endif
|
|
|
|
#ifndef SUINT
|
|
#define SUINT unsigned
|
|
#endif
|
|
|
|
#endif |