UFO: Alien Invasion
Loading...
Searching...
No Matches
byte.cpp
Go to the documentation of this file.
1
5
6/*
7All original material Copyright (C) 2002-2025 UFO: Alien Invasion.
8
9Copyright (C) 1997-2001 Id Software, Inc.
10
11This program is free software; you can redistribute it and/or
12modify it under the terms of the GNU General Public License
13as published by the Free Software Foundation; either version 2
14of the License, or (at your option) any later version.
15
16This program is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19
20See the GNU General Public License for more details.
21
22You should have received a copy of the GNU General Public License
23along with this program; if not, write to the Free Software
24Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
26*/
27
28#include "byte.h"
29#include "../common/common.h"
30
31void 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}
void Swap_Init(void)
Definition byte.cpp:31
Byte order functions header.
void Com_Printf(const char *const fmt,...)
Definition common.cpp:428
definitions common between client and server, but not game lib
void Sys_Error(const char *error,...)
Definition g_main.cpp:421