diff options
Diffstat (limited to 'deps/libchdr/bitstream.c')
-rw-r--r-- | deps/libchdr/bitstream.c | 63 |
1 files changed, 35 insertions, 28 deletions
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 <stdlib.h> -//************************************************************************** -// 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) { |