m_swap.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Emacs style mode select -*- C++ -*-
  2. //-----------------------------------------------------------------------------
  3. //
  4. // $Id:$
  5. //
  6. // Copyright (C) 1993-1996 by id Software, Inc.
  7. //
  8. // This source is available for distribution and/or modification
  9. // only under the terms of the DOOM Source Code License as
  10. // published by id Software. All rights reserved.
  11. //
  12. // The source is distributed in the hope that it will be useful,
  13. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
  15. // for more details.
  16. //
  17. // DESCRIPTION:
  18. // Endianess handling, swapping 16bit and 32bit.
  19. //
  20. //-----------------------------------------------------------------------------
  21. #ifndef __M_SWAP__
  22. #define __M_SWAP__
  23. #ifdef __GNUG__
  24. #pragma interface
  25. #endif
  26. // Endianess handling.
  27. // WAD files are stored little endian.
  28. #ifdef __BIG_ENDIAN__
  29. short SwapSHORT(short);
  30. long SwapLONG(long);
  31. #define SHORT(x) ((short)SwapSHORT((unsigned short) (x)))
  32. #define LONG(x) ((long)SwapLONG((unsigned long) (x)))
  33. #else
  34. #define SHORT(x) (x)
  35. #define LONG(x) (x)
  36. #endif
  37. #endif
  38. //-----------------------------------------------------------------------------
  39. //
  40. // $Log:$
  41. //
  42. //-----------------------------------------------------------------------------