source: abuse/trunk/src/net/endian.hpp @ 57

Last change on this file since 57 was 57, checked in by Sam Hocevar, 14 years ago
  • Move each header to the same directory as its corresponding source, to get a better idea of which files are likely to export symbols.
File size: 665 bytes
Line 
1#ifndef __INDIANS__HPP_
2#define __INDIANS__HPP_
3
4#error hi
5
6
7#ifdef __linux__
8#include <asm/byteorder.h>
9#endif
10
11#ifdef __sgi
12#include <sys/endian.h>
13#endif
14
15
16
17// these macros swap the "endians" of a word to intel form... this should be done for anything sent
18// across the net as the other computer might have a different endianess
19
20#ifdef BIGUNS
21#define swap_uint16(x) (((((uint16_t) (x)))<<8)|((((uint16_t) (x)))>>8))
22#define swap_uint32(x) \
23   ((( ((uint32_t)(x)) )>>24)|((( ((uint32_t)(x)) )&0x00ff0000)>>8)| \
24   ((( ((uint32_t)(x)) )&0x0000ff00)<<8)|(( ((uint32_t)(x)) )<<24))
25#else
26#define swap_uint16(x) (x)
27#define swap_uint32(x) (x)
28
29#endif
30
31#endif
32
33
34
35
Note: See TracBrowser for help on using the repository browser.