source: abuse/trunk/src/net/include/indian.hpp @ 2

Last change on this file since 2 was 2, checked in by Sam Hocevar, 14 years ago
  • imported original 0.7.0 tarball
File size: 590 bytes
Line 
1#ifndef lltl
2
3#ifdef __sgi
4#define BIGUNS
5#endif
6
7
8// these macros swap the "endians" of a word to intel form... this should be done for anything sent
9// across the net as the other computer might have a different endianess
10
11#ifdef BIGUNS
12#define lstl(x) (((((unsigned short) (x)))<<8)|((((unsigned short) (x)))>>8))
13#define lltl(x) \
14   ((( ((unsigned long)(x)) )>>24)|((( ((unsigned long)(x)) )&0x00ff0000)>>8)| \
15   ((( ((unsigned long)(x)) )&0x0000ff00)<<8)|(( ((unsigned long)(x)) )<<24))
16#else
17#define lstl(x) (x)
18#define lltl(x) (x)
19
20#endif
21
22#define uchar unsigned char
23
24#endif
25
26
27
28
29
Note: See TracBrowser for help on using the repository browser.