Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
298 | serge | 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 | static const char |
||
25 | rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; |
||
26 | |||
27 | |||
28 | #ifdef __GNUG__ |
||
29 | #pragma implementation "m_swap.h" |
||
30 | #endif |
||
31 | #include "m_swap.h" |
||
32 | |||
33 | |||
34 | // Swap 16bit, that is, MSB and LSB byte. |
||
35 | unsigned short SwapSHORT(unsigned short x) |
||
36 | { |
||
37 | // No masking with 0xFF should be necessary. |
||
38 | return (x>>8) | (x<<8); |
||
39 | } |
||
40 | |||
41 | // Swapping 32bit. |
||
42 | unsigned long SwapLONG( unsigned long x) |
||
43 | { |
||
44 | return |
||
45 | (x>>24) |
||
46 | | ((x>>8) & 0xff00) |
||
47 | | ((x<<8) & 0xff0000) |
||
48 | | (x<<24); |
||
49 | }24); |
||
50 | |||
51 |