object: start implement bit-buffer data structure
This commit is contained in:
30
object/include/blue/object/bitbuffer.h
Normal file
30
object/include/blue/object/bitbuffer.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#ifndef BLUE_OBJECT_BITBUFFER_H_
|
||||
#define BLUE_OBJECT_BITBUFFER_H_
|
||||
|
||||
#include <blue/object/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_OBJECT(buf)));
|
||||
}
|
||||
static inline void b_bitbuffer_release(b_bitbuffer *buf)
|
||||
{
|
||||
b_release(B_OBJECT(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
|
||||
Reference in New Issue
Block a user