2014-06-01 17:55:23 +00:00
|
|
|
/*
|
2018-09-02 00:57:29 +00:00
|
|
|
* This file is part of the DXX-Rebirth project <https://www.dxx-rebirth.com/>.
|
2014-06-01 17:55:23 +00:00
|
|
|
* It is copyright by its individual contributors, as recorded in the
|
|
|
|
* project's Git history. See COPYING.txt at the top level for license
|
|
|
|
* terms and a link to the Git history.
|
|
|
|
*/
|
2006-03-20 16:43:15 +00:00
|
|
|
/*
|
|
|
|
*
|
2010-08-09 19:19:36 +00:00
|
|
|
* Common types and defines
|
2006-03-20 16:43:15 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _TYPES_H
|
|
|
|
#define _TYPES_H
|
|
|
|
|
2010-10-10 10:42:53 +00:00
|
|
|
#ifndef macintosh
|
2010-08-09 19:19:36 +00:00
|
|
|
#include <sys/types.h>
|
2010-10-10 10:42:53 +00:00
|
|
|
#endif
|
|
|
|
|
2016-10-31 02:17:54 +00:00
|
|
|
#include <cstdint>
|
2010-08-09 19:19:36 +00:00
|
|
|
#include <limits.h>
|
|
|
|
|
2008-01-23 17:25:09 +00:00
|
|
|
//define a signed byte
|
2006-10-06 14:41:31 +00:00
|
|
|
typedef signed char sbyte;
|
2006-03-20 16:43:15 +00:00
|
|
|
|
|
|
|
//define unsigned types;
|
|
|
|
typedef unsigned char ubyte;
|
2008-04-06 20:23:28 +00:00
|
|
|
#if defined(_WIN32) || defined(macintosh)
|
2008-01-03 10:31:02 +00:00
|
|
|
typedef unsigned short ushort;
|
|
|
|
typedef unsigned int uint;
|
|
|
|
#endif
|
2006-03-20 16:43:15 +00:00
|
|
|
|
2008-04-06 20:23:28 +00:00
|
|
|
#if defined(_WIN32) || defined(__sun__) // platforms missing (u_)int??_t
|
2013-06-30 02:22:56 +00:00
|
|
|
# include <SDL_types.h>
|
2008-01-03 10:31:02 +00:00
|
|
|
#elif defined(macintosh) // misses (u_)int??_t and does not like SDL_types.h
|
|
|
|
# include <MacTypes.h>
|
2008-01-23 17:25:09 +00:00
|
|
|
typedef SInt16 int16_t;
|
|
|
|
typedef SInt32 int32_t;
|
|
|
|
typedef SInt64 int64_t;
|
2015-01-03 06:34:13 +00:00
|
|
|
typedef UInt16 uint16_t;
|
|
|
|
typedef UInt32 uint32_t;
|
|
|
|
typedef UInt64 uint64_t;
|
2008-01-03 10:31:02 +00:00
|
|
|
#endif // macintosh
|
2008-04-06 20:23:28 +00:00
|
|
|
#if defined(_WIN32) || defined(__sun__) // platforms missing u_int??_t
|
2015-01-03 06:34:13 +00:00
|
|
|
typedef Uint16 uint16_t;
|
|
|
|
typedef Uint32 uint32_t;
|
|
|
|
typedef Uint64 uint64_t;
|
2008-04-06 20:23:28 +00:00
|
|
|
#endif // defined(_WIN32) || defined(__sun__)
|
2008-01-03 10:31:02 +00:00
|
|
|
|
2008-01-23 17:25:09 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
# include <stdlib.h> // this is where min and max are defined
|
|
|
|
#endif
|
2006-03-20 16:43:15 +00:00
|
|
|
|
2008-01-13 00:58:49 +00:00
|
|
|
// the following stuff has nothing to do with types but needed everywhere,
|
|
|
|
// and since this file is included everywhere, it's here.
|
2010-12-04 20:58:59 +00:00
|
|
|
#if defined(__i386__) || defined(__ia64__) || defined(_WIN32) || \
|
2008-01-13 00:58:49 +00:00
|
|
|
(defined(__alpha__) || defined(__alpha)) || \
|
|
|
|
defined(__arm__) || defined(ARM) || \
|
|
|
|
(defined(__mips__) && defined(__MIPSEL__)) || \
|
|
|
|
defined(__SYMBIAN32__) || \
|
|
|
|
defined(__x86_64__) || \
|
|
|
|
defined(__LITTLE_ENDIAN__) // from physfs_internal.h
|
|
|
|
//# define WORDS_BIGENDIAN 0
|
|
|
|
#else
|
|
|
|
# define WORDS_BIGENDIAN 1
|
|
|
|
#endif
|
|
|
|
|
2006-03-20 16:43:15 +00:00
|
|
|
#ifdef __GNUC__
|
2013-08-25 17:13:37 +00:00
|
|
|
#ifdef WIN32
|
2015-03-19 02:31:22 +00:00
|
|
|
# define __pack__ __attribute__((gcc_struct, packed))
|
|
|
|
#else
|
|
|
|
# define __pack__ __attribute__((packed))
|
2013-08-25 17:13:37 +00:00
|
|
|
#endif
|
2008-01-03 10:31:02 +00:00
|
|
|
#elif defined(_MSC_VER)
|
|
|
|
# pragma pack(push, packing)
|
|
|
|
# pragma pack(1)
|
|
|
|
# define __pack__
|
|
|
|
#elif defined(macintosh)
|
|
|
|
# pragma options align=packed
|
|
|
|
# define __pack__
|
2006-03-20 16:43:15 +00:00
|
|
|
#else
|
2013-03-03 01:01:28 +00:00
|
|
|
# error "This program will not work without packed structures"
|
2006-03-20 16:43:15 +00:00
|
|
|
#endif
|
|
|
|
|
2008-01-23 17:25:09 +00:00
|
|
|
#endif //_TYPES_H
|
|
|
|
|