Annotation of doom/m_swap.c, revision 1.1.1.2

1.1       root        1: // Emacs style mode select   -*- C++ -*- 
                      2: //-----------------------------------------------------------------------------
                      3: //
                      4: // $Id:$
                      5: //
                      6: // Copyright (C) 1993-1996 by id Software, Inc.
                      7: //
1.1.1.2 ! root        8: // This program is free software; you can redistribute it and/or
        !             9: // modify it under the terms of the GNU General Public License
        !            10: // as published by the Free Software Foundation; either version 2
        !            11: // of the License, or (at your option) any later version.
1.1       root       12: //
1.1.1.2 ! root       13: // This program is distributed in the hope that it will be useful,
1.1       root       14: // but WITHOUT ANY WARRANTY; without even the implied warranty of
1.1.1.2 ! root       15: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !            16: // GNU General Public License for more details.
1.1       root       17: //
                     18: // $Log:$
                     19: //
                     20: // DESCRIPTION:
                     21: //     Endianess handling, swapping 16bit and 32bit.
                     22: //
                     23: //-----------------------------------------------------------------------------
                     24: 
                     25: static const char
                     26: rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $";
                     27: 
                     28: 
                     29: #ifdef __GNUG__
                     30: #pragma implementation "m_swap.h"
                     31: #endif
                     32: #include "m_swap.h"
                     33: 
                     34: 
                     35: // Not needed with big endian.
                     36: #ifndef __BIG_ENDIAN__
                     37: 
                     38: // Swap 16bit, that is, MSB and LSB byte.
                     39: unsigned short SwapSHORT(unsigned short x)
                     40: {
                     41:     // No masking with 0xFF should be necessary. 
                     42:     return (x>>8) | (x<<8);
                     43: }
                     44: 
                     45: // Swapping 32bit.
                     46: unsigned long SwapLONG( unsigned long x)
                     47: {
                     48:     return
                     49:        (x>>24)
                     50:        | ((x>>8) & 0xff00)
                     51:        | ((x<<8) & 0xff0000)
                     52:        | (x<<24);
                     53: }
                     54: 
                     55: 
                     56: #endif
                     57: 
                     58: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.