SingingCat 0
application
shifter.h
1#ifndef SHIFTER_H
2#define SHIFTER_H
3#include <stdint.h>
4// NOTE: this isn't really metrics specific but quite generic
5
6typedef struct shifter {
7 int bufsize; // max size of buffer
8 int validbytes; // valid bytes in buffer
9 int error; // if non-zero, an error occured
10 uint8_t * buf;
11} _shifter;
12
13// init a shifter for first use
14void shifter_init(struct shifter *sh, uint8_t *buf, int bufsize);
15void shift_into_uint8(struct shifter *sh, uint8_t b);
16void shift_into_uint32(struct shifter *sh, uint32_t b);
17void shift_into_uint64(struct shifter *sh, uint64_t b);
18// return number of bytes shifted into buffer
19int shift_size(struct shifter *sh);
20// if non-zero an error occured on this shifter
21int shift_error(struct shifter *sh);
22#endif
Definition: shifter.h:6