summaryrefslogtreecommitdiff
path: root/src/data.h
blob: 61a9e007856368950790b2fbcfebf92ece46b2e6 (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
#include "types.h"

static inline u8
get_u8(unsigned char **p)
{
	return *((*p)++);
}

static inline u16
get_u16(unsigned char **p) {
	u16 ret;
	ret=*((u16 *)*p);
	*p+=sizeof(u16);
	return ret;
}

static inline u32
get_u24(unsigned char **p) {
	u32 ret;
	ret=get_u16(p);
	ret|=*((*p)++) << 16;
	return ret;
}


static inline u32
get_u32(unsigned char **p) {
	u32 ret;
	ret=*((u32 *)*p);
	*p+=sizeof(u32);
	return ret;
}

static inline char *
get_string(unsigned char **p)
{
        char *ret=(char *)(*p);
        while (**p) (*p)++;
        (*p)++;
        return ret;
}