-// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
-/***************************************************************************
+/* license:BSD-3-Clause
+ * copyright-holders:Aaron Giles
+***************************************************************************
bitstream.c
#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)
{
}
-//-----------------------------------------------------
-// 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)
}
}
- // 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)
{
}
-//-----------------------------------------------------
-// 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)
{
}
-//-------------------------------------------------
-// read_offset - return the current read offset
-//-------------------------------------------------
+/*-------------------------------------------------
+ * read_offset - return the current read offset
+ *-------------------------------------------------
+ */
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)
{