blob: b1b635f115dd1cfc26efc8db34970b023a6957ce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#ifndef EINA_INTBUF_H
#define EINA_INTBUF_H
/**
* @addtogroup Eina_Integer_Buffer_Group Compressed Integer Buffer
*
* @brief The functions provide compressed integer buffers management.
*
* The compressed integer buffer data type is designed to be compress once,
* but being read very often and very fast. The data set that it is designed
* for should be incremental integer (positive and negative direction
* are supported).
*/
/**
* @addtogroup Eina_Data_Types_Group Data Types
*
* @{
*/
/**
* @defgroup Eina_Integer_Buffer_Group Compressed Ieger Buffer
*
* @{
*/
/**
* @typedef Eina_Intbuf
* Type for a compressed integer buffer.
*/
typedef struct _Eina_Intbuf Eina_Intbuf;
struct _Eina_Intbuf
{
int last_data;
unsigned int length;
unsigned char *bytes;
};
/**
* @brief Create a new compressed integer buffer.
*
* @return Newly allocated compressed integer buffer instance.
*/
static inline Eina_Intbuf *eina_intbuf_new(void);
/**
* @brief Free a compressed integer buffer.
*
* @param buf The compressed integer buffer to free.
*/
static void eina_intbuf_free(Eina_Intbuf *buf);
/**
* @brief Push an integer at the end of an compressed integer buffer.
*
* @param buf The compressed integer buffer tofree.
* @param data The integer to push in.
*/
static inline void eina_intbuf_push(Eina_Intbuf *buf, int data);
/**
* @brief
*/
static inline inline Eina_Bool
eina_intbuf_read(Eina_Intbuf *buf,
unsigned int *buffer_offset,
int *data);
#define EINA_INTBUF_FOREACH(buf, it, data) \
for (it = 0, data = eina_intbuf_read(buf, &it, data); \
eina_intbuf_read(buf, &it, &data); )
#include "eina_intbuf.x"
/**
* @}
*/
/**
* @}
*/
#endif
|