UFO: Alien Invasion
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
byte.cpp
Go to the documentation of this file.
1
6
/*
7
All original material Copyright (C) 2002-2020 UFO: Alien Invasion.
8
9
Copyright (C) 1997-2001 Id Software, Inc.
10
11
This program is free software; you can redistribute it and/or
12
modify it under the terms of the GNU General Public License
13
as published by the Free Software Foundation; either version 2
14
of the License, or (at your option) any later version.
15
16
This program is distributed in the hope that it will be useful,
17
but WITHOUT ANY WARRANTY; without even the implied warranty of
18
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19
20
See the GNU General Public License for more details.
21
22
You should have received a copy of the GNU General Public License
23
along with this program; if not, write to the Free Software
24
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
26
*/
27
28
#include "
byte.h
"
29
#include "../common/common.h"
30
31
void
Swap_Init
(
void
)
32
{
33
union
{
34
byte
b[2];
35
unsigned
short
s;
36
} swaptest;
37
38
Com_Printf
(
"---- endianness initialization -----\n"
);
39
40
swaptest.b[0] = 1;
41
swaptest.b[1] = 0;
42
43
/* set the byte swapping variables in a portable manner */
44
if
(swaptest.s == 1) {
45
Com_Printf
(
"found little endian system\n"
);
46
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
47
Sys_Error
(
"SDL was compiled in big endian mode"
);
48
#endif
49
}
else
{
50
Com_Printf
(
"found big endian system\n"
);
51
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
52
Sys_Error
(
"SDL was compiled in little endian mode"
);
53
#endif
54
}
55
}
Sys_Error
void Sys_Error(const char *error,...)
Definition:
g_main.cpp:421
Swap_Init
void Swap_Init(void)
Definition:
byte.cpp:31
Com_Printf
void Com_Printf(const char *const fmt,...)
Definition:
common.cpp:386
byte.h
Byte order functions header.
byte
uint8_t byte
Definition:
ufotypes.h:34
src
shared
byte.cpp
Generated on Mon Feb 24 2020 05:28:06 for UFO: Alien Invasion by
1.8.8