All Projects → c0x0o → bipbuffer

c0x0o / bipbuffer

Licence: MIT license
a C implementation of Simon Cooke's bipbuffer

Programming Languages

c
50402 projects - #5 most used programming language
CMake
9771 projects

Projects that are alternatives of or similar to bipbuffer

Corrode
A batteries-included library for reading binary data.
Stars: ✭ 116 (+673.33%)
Mutual labels:  buffer
Lwrb
Lightweight generic ring buffer manager library
Stars: ✭ 215 (+1333.33%)
Mutual labels:  buffer
RingBuffer
模仿 kfifo 实现的环形缓冲区
Stars: ✭ 64 (+326.67%)
Mutual labels:  buffer
Pex Context
Modern WebGL state wrapper for PEX: allocate GPU resources (textures, buffers), setup state pipelines and passes, and combine them into commands.
Stars: ✭ 117 (+680%)
Mutual labels:  buffer
File Type
Detect the file type of a Buffer/Uint8Array/ArrayBuffer
Stars: ✭ 2,386 (+15806.67%)
Mutual labels:  buffer
NALib
General purpose C sourcecode collection
Stars: ✭ 16 (+6.67%)
Mutual labels:  buffer
Bytearray.js
An equivalent to Actionscript 3's ByteArray for Javascript with AMF0 and AMF3 support.
Stars: ✭ 100 (+566.67%)
Mutual labels:  buffer
go-disk-buffer
This package helps to work with huge amount of data, which cannot be stored in RAM
Stars: ✭ 39 (+160%)
Mutual labels:  buffer
Flake Idgen
Flake ID generator yields k-ordered, conflict-free ids in a distributed environment in Node.js
Stars: ✭ 196 (+1206.67%)
Mutual labels:  buffer
ember-validated-form-buffer
A validated form buffer that wraps Ember Data models for use in forms.
Stars: ✭ 46 (+206.67%)
Mutual labels:  buffer
Vim Ctrlspace
Vim Space Controller
Stars: ✭ 1,621 (+10706.67%)
Mutual labels:  buffer
Ring Buffer
A simple ring buffer (circular buffer) designed for embedded systems.
Stars: ✭ 137 (+813.33%)
Mutual labels:  buffer
overflow
A command-line tool for exploiting stack-based buffer overflow vulnerabilities.
Stars: ✭ 66 (+340%)
Mutual labels:  buffer
Reactiveplaybilling
An RxJava wrapper for the Google Play Billing Library
Stars: ✭ 117 (+680%)
Mutual labels:  buffer
biguint-format
Node.js module to format big uint numbers from a byte array or a Buffer
Stars: ✭ 16 (+6.67%)
Mutual labels:  buffer
Oscp Prep
my oscp prep collection
Stars: ✭ 105 (+600%)
Mutual labels:  buffer
buffer
DEPRECATED Send social updates to Twitter, Facebook, etc. through Buffer.com via Twig templates, URLs, and plugins.
Stars: ✭ 43 (+186.67%)
Mutual labels:  buffer
codec
Encode keys, values and range options, with built-in or custom encodings.
Stars: ✭ 27 (+80%)
Mutual labels:  buffer
Pulse
❤️ A heart rate camera pulse detector written in Swift.
Stars: ✭ 53 (+253.33%)
Mutual labels:  buffer
WebServer
High-performance multi-threaded tcp network server in c++11
Stars: ✭ 58 (+286.67%)
Mutual labels:  buffer

bipbuffer

introduction

This project is a C implementation of Simon Cooke's bipbuffer. Bipbuffer is a special kind of circular buffer. Just like the circular buffer, it avoids byte moving or copying during the lifetime of the buffer, but more impressive, bipbuffer don't transform the buffer pointer when it reaches the end of the buffer because bipbuffer always alloc a contiguous space for you. If you want to know more about it, see the link.

Usage

You can just copy the files in src directory(including header file and source files), and compile them yourself, or you can use CMake to get a static library. Run cmake ${bipbuffer_dir} && make in any directory for a try, libbipbuffer.a is waiting for you in lib ^o^

API

data structure

struct bipbuffer;

use it to represent a bipbuffer

function

// 'size' means the size of buffer, it will be rounded up to the nearest 'n*pagesize'
struct bipbuffer* bb_create(long int size);
void bb_destroy(struct bipbuffer *buffP);

// clear all data in buffer and reset the buffer
void bb_clear(struct bipbuffer *buffP);

// pushing data into the buffer is divided into two steps:
// first use 'bb_alloc' to get a pointer can contain 'size' bytes data,
// after the IO operation, use 'bb_commit' to confirm the quantity of data you actual write in.
void *bb_alloc(struct bipbuffer *buffP, long int size);
int bb_commit(struct bipbuffer *buffP, long int size);

// read 'size' bytes data from buffer
long int bb_read(struct bipbuffer *buffP, void *dst, long int size);

// the same as 'bb_read', but it won't remove the data from the buffer
// if you only want to know whether there is enough data in buffer, pass a NULL to 'dst'
long int bb_look(struct bipbuffer *buffP, void *dst, long int size);

you can see more details in bipbuffer.h(I guess you need them).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].