From 9c659ffe685d5615b15c31cd86814e597cff7488 Mon Sep 17 00:00:00 2001 From: negativeExponent Date: Fri, 5 Jun 2020 19:56:44 +0800 Subject: libchdr: Update to latest upstream Update libchdr based from latest upstream sources. Fixes some issues as noted. - Latest upstream commit: https://github.com/rtissera/libchdr/tree/6117d59d00ef8620de4cff4d6ecae46368cae881 - Fix https://github.com/libretro/pcsx_rearmed/issues/301 - Specific commit that fixes above problem: https://github.com/rtissera/libchdr/commit/e1acac6d83b36531e543e39a9e1a363e681083e6 --- deps/libchdr/bitstream.c | 63 +++++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 28 deletions(-) (limited to 'deps/libchdr/bitstream.c') diff --git a/deps/libchdr/bitstream.c b/deps/libchdr/bitstream.c index 735b97f..3f61c93 100644 --- a/deps/libchdr/bitstream.c +++ b/deps/libchdr/bitstream.c @@ -1,6 +1,6 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles -/*************************************************************************** +/* license:BSD-3-Clause + * copyright-holders:Aaron Giles +*************************************************************************** bitstream.c @@ -11,15 +11,17 @@ #include "bitstream.h" #include -//************************************************************************** -// INLINE FUNCTIONS -//************************************************************************** +/*************************************************************************** + * INLINE FUNCTIONS + *************************************************************************** + */ int bitstream_overflow(struct bitstream* bitstream) { return ((bitstream->doffset - bitstream->bits / 8) > bitstream->dlength); } -//------------------------------------------------- -// create_bitstream - constructor -//------------------------------------------------- +/*------------------------------------------------- + * create_bitstream - constructor + *------------------------------------------------- + */ struct bitstream* create_bitstream(const void *src, uint32_t srclength) { @@ -33,17 +35,18 @@ struct bitstream* create_bitstream(const void *src, uint32_t srclength) } -//----------------------------------------------------- -// bitstream_peek - fetch the requested number of bits -// but don't advance the input pointer -//----------------------------------------------------- +/*----------------------------------------------------- + * bitstream_peek - fetch the requested number of bits + * but don't advance the input pointer + *----------------------------------------------------- + */ uint32_t bitstream_peek(struct bitstream* bitstream, int numbits) { if (numbits == 0) return 0; - // fetch data if we need more + /* fetch data if we need more */ if (numbits > bitstream->bits) { while (bitstream->bits <= 24) @@ -55,15 +58,16 @@ uint32_t bitstream_peek(struct bitstream* bitstream, int numbits) } } - // return the data + /* return the data */ return bitstream->buffer >> (32 - numbits); } -//----------------------------------------------------- -// bitstream_remove - advance the input pointer by the -// specified number of bits -//----------------------------------------------------- +/*----------------------------------------------------- + * bitstream_remove - advance the input pointer by the + * specified number of bits + *----------------------------------------------------- + */ void bitstream_remove(struct bitstream* bitstream, int numbits) { @@ -72,9 +76,10 @@ void bitstream_remove(struct bitstream* bitstream, int numbits) } -//----------------------------------------------------- -// bitstream_read - fetch the requested number of bits -//----------------------------------------------------- +/*----------------------------------------------------- + * bitstream_read - fetch the requested number of bits + *----------------------------------------------------- + */ uint32_t bitstream_read(struct bitstream* bitstream, int numbits) { @@ -84,9 +89,10 @@ uint32_t bitstream_read(struct bitstream* bitstream, int numbits) } -//------------------------------------------------- -// read_offset - return the current read offset -//------------------------------------------------- +/*------------------------------------------------- + * read_offset - return the current read offset + *------------------------------------------------- + */ uint32_t bitstream_read_offset(struct bitstream* bitstream) { @@ -101,9 +107,10 @@ uint32_t bitstream_read_offset(struct bitstream* bitstream) } -//------------------------------------------------- -// flush - flush to the nearest byte -//------------------------------------------------- +/*------------------------------------------------- + * flush - flush to the nearest byte + *------------------------------------------------- + */ uint32_t bitstream_flush(struct bitstream* bitstream) { -- cgit v1.2.3