home *** CD-ROM | disk | FTP | other *** search
/ ST-Computer Leser-CD 2000 January / LCD_01_2000.iso / games / doom / pmdoom / src / m_swap.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-12-17  |  1.2 KB  |  44 lines

  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. /*  $Log:$ */
  18. /*  */
  19. /*  DESCRIPTION: */
  20. /*     Endianess handling, swapping 16bit and 32bit. */
  21. /*  */
  22. /* ----------------------------------------------------------------------------- */
  23.  
  24. #include "m_swap.h"
  25.  
  26. #ifndef ATARI
  27. /*  Swap 16bit, that is, MSB and LSB byte. */
  28. unsigned short SwapSHORT(unsigned short x)
  29. {
  30.     /*  No masking with 0xFF should be necessary.  */
  31.     return (x>>8) | (x<<8);
  32. }
  33.  
  34. /*  Swapping 32bit. */
  35. unsigned long SwapLONG( unsigned long x)
  36. {
  37.     return
  38.     (x>>24)
  39.     | ((x>>8) & 0xff00)
  40.     | ((x<<8) & 0xff0000)
  41.     | (x<<24);
  42. }
  43. #endif
  44.