Statistics
| Branch: | Revision:

grapes / src / int_coding.h @ 60fa723d

History | View | Annotate | Download (303 Bytes)

1
#ifndef INT_CODING
2
#define INT_CODING
3

    
4
static inline void int_cpy(uint8_t *p, int v)
5
{
6
  uint32_t tmp;
7
  
8
  tmp = htonl(v);
9
  memcpy(p, &tmp, 4);
10
}
11

    
12
static inline uint32_t int_rcpy(const uint8_t *p)
13
{
14
  uint32_t tmp;
15
  
16
  memcpy(&tmp, p, 4);
17
  tmp = ntohl(tmp);
18

    
19
  return tmp;
20
}
21
#endif        /* INT_CODING */