[FFmpeg-devel] [PATCH] add put_bits_long to avoid undefined behaviour in put_bits
Diego Biurrun
diego
Mon Aug 24 12:12:04 CEST 2009
On Sat, Aug 22, 2009 at 10:22:19PM +0200, matthieu castet wrote:
>
> --- libavcodec/put_bits.h (r?vision 19681)
> +++ libavcodec/put_bits.h (copie de travail)
> @@ -259,6 +259,22 @@
>
> +static inline void put_bits_long(PutBitContext *s, int n, unsigned int value)
> +{
> + if(n<=31)
> + put_bits(s, n, value);
> + else{
> +#ifdef ALT_BITSTREAM_READER_LE
> + put_bits(s, 16, value & 0xffff);
> + put_bits(s, 16, value >> 16);
> +#else
> + put_bits(s, 16, value >> 16);
> + put_bits(s, 16, value & 0xffff);
> +#endif
> + }
> +
> +}
K&R style please and lose those tabs.
Diego
More information about the ffmpeg-devel
mailing list