Subversion Repositories Kolibri OS

Rev

Rev 298 | Go to most recent revision | Details | Compare with Previous | 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
 
333 serge 34
// Not needed with big endian.
35
#ifndef __BIG_ENDIAN__
36
 
298 serge 37
// Swap 16bit, that is, MSB and LSB byte.
38
unsigned short SwapSHORT(unsigned short x)
39
{
40
    // No masking with 0xFF should be necessary.
41
    return (x>>8) | (x<<8);
42
}
43
 
44
// Swapping 32bit.
45
unsigned long SwapLONG( unsigned long x)
46
{
47
    return
48
	(x>>24)
49
	| ((x>>8) & 0xff00)
50
	| ((x<<8) & 0xff0000)
51
	| (x<<24);
52
}
53
 
54
 
333 serge 55
#endif
56
 
57