2024-04-20 15:57:49 +00:00
|
|
|
/*
|
|
|
|
* Descent 3
|
|
|
|
* Copyright (C) 2024 Parallax Software
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2024-04-16 03:43:29 +00:00
|
|
|
/*
|
2024-04-16 18:56:40 +00:00
|
|
|
* $Logfile: /DescentIII/Main/lib/psendian.h $
|
|
|
|
* $Revision: 1 $
|
|
|
|
* $Date: 5/05/99 5:26a $
|
|
|
|
* $Author: Jeff $
|
|
|
|
*
|
|
|
|
* Big/Little Endian detection and functions
|
|
|
|
*
|
|
|
|
* $Log: /DescentIII/Main/lib/psendian.h $
|
|
|
|
*
|
2024-04-16 03:43:29 +00:00
|
|
|
* 1 5/05/99 5:26a Jeff
|
2024-04-16 18:56:40 +00:00
|
|
|
*
|
2024-04-16 03:43:29 +00:00
|
|
|
* 3 5/01/99 8:47p Jeff
|
|
|
|
* removed 2 useless functions, use externC for linux compile
|
2024-04-16 18:56:40 +00:00
|
|
|
*
|
2024-04-16 03:43:29 +00:00
|
|
|
* 2 5/01/99 2:52p Jeff
|
|
|
|
* added automatic endian detection of the system
|
2024-04-16 18:56:40 +00:00
|
|
|
*
|
|
|
|
* $NoKeywords: $
|
|
|
|
*/
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
#ifndef __ENDIAN_H___
|
|
|
|
#define __ENDIAN_H___
|
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
extern "C" {
|
2024-04-16 03:43:29 +00:00
|
|
|
// Endian_IsLittleEndian
|
|
|
|
//
|
|
|
|
// Returns true if the machine is Little Endian (i.e. 80x86)
|
|
|
|
// Returns false if the machine is Big Endian (i.e. Macintosh)
|
|
|
|
bool Endian_IsLittleEndian(void);
|
|
|
|
|
|
|
|
// Swaps (if needed) a short value (2 bytes) (assumes incoming value is in little endian format)
|
|
|
|
short Endian_SwapShort(short value);
|
|
|
|
|
|
|
|
// Swaps (if needed) an int value (4 bytes) (assumes incoming value is in little endian format)
|
|
|
|
int Endian_SwapInt(int value);
|
|
|
|
|
|
|
|
// Swaps (if needed) a float value (4 bytes) (assumes incoming value is in little endian format)
|
|
|
|
float Endian_SwapFloat(float value);
|
|
|
|
}
|
|
|
|
#endif
|