Allocate a new bitbuffer.
Given the size requested, create a new bit buffer which can store that number of bits and return it having initialised it properly.
|size ||The number of bits to store in this buffer. |
- The new BitBuffer
Definition at line 27 of file bitbuffer.c.
int bytesize = ((size + 7) & ~7) >> 3;
BitBuffer ret = (BitBuffer)(malloc(sizeof(struct bitbuffer_s) + bytesize));
ret->size = size;
ret->firstused = 0;
ret->nextfree = 0;
ret->bitsused = 0;