Files
bluelib/ds/include/blue/ds/bitbuffer.h

31 lines
886 B
C
Raw Normal View History

#ifndef BLUE_OBJECT_BITBUFFER_H_
#define BLUE_OBJECT_BITBUFFER_H_
#include <blue/ds/object.h>
#define B_BITBUFFER(p) ((b_bitbuffer *)(p))
typedef struct b_bitbuffer b_bitbuffer;
BLUE_API b_bitbuffer *b_bitbuffer_create(void);
static inline b_bitbuffer *b_bitbuffer_retain(b_bitbuffer *buf)
{
return B_BITBUFFER(b_retain(B_DSREF(buf)));
}
static inline void b_bitbuffer_release(b_bitbuffer *buf)
{
b_release(B_DSREF(buf));
}
BLUE_API b_status b_bitbuffer_put_bit(b_bitbuffer *buf, int bit);
BLUE_API b_status b_bitbuffer_put_bool(b_bitbuffer *buf, bool b);
BLUE_API b_status b_bitbuffer_put_int(
b_bitbuffer *buf, uint64_t v, unsigned int nr_bits);
BLUE_API b_status b_bitbuffer_put_bytes(
b_bitbuffer *buf, const void *p, size_t len, size_t bits_per_byte);
BLUE_API b_status b_bitbuffer_put_string(
b_bitbuffer *buf, const char *p, size_t len, size_t bits_per_char);
#endif