home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / ABUSESRC.ZIP / AbuseSrc / macabuse / src / net / unix / endian.hpp next >
Encoding:
C/C++ Source or Header  |  1997-05-20  |  757 b   |  38 lines

  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_short(x) (((((unsigned short) (x)))<<8)|((((unsigned short) (x)))>>8))
  22. #define swap_long(x) \
  23.    ((( ((unsigned long)(x)) )>>24)|((( ((unsigned long)(x)) )&0x00ff0000)>>8)| \
  24.    ((( ((unsigned long)(x)) )&0x0000ff00)<<8)|(( ((unsigned long)(x)) )<<24))
  25. #else
  26. #define swap_short(x) (x)
  27. #define swap_long(x) (x)
  28.  
  29. #endif
  30.  
  31. #define uchar unsigned char
  32.  
  33. #endif
  34.  
  35.  
  36.  
  37.  
  38.