wine/include/basetsd.h

135 lines
4.2 KiB
C
Raw Normal View History

/*
* Compilers that uses ILP32, LP64 or P64 type models
* for both Win32 and Win64 are supported by this file.
*
* Copyright (C) 1999 Patrik Stridvall
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WINE_BASETSD_H
#define __WINE_BASETSD_H
#ifdef __cplusplus
extern "C" {
#endif /* defined(__cplusplus) */
/*
* Win32 was easy to implement under Unix since most (all?) 32-bit
* Unices uses the same type model (ILP32) as Win32, where int, long
* and pointer are 32-bit.
*
* Win64, however, will cause some problems when implemented under Unix.
* Linux/{Alpha, Sparc64} and most (all?) other 64-bit Unices uses
* the LP64 type model where int is 32-bit and long and pointer are
* 64-bit. Win64 on the other hand uses the P64 (sometimes called LLP64)
* type model where int and long are 32 bit and pointer is 64-bit.
*/
/* Type model indepent typedefs */
2002-02-05 18:09:29 +00:00
#ifndef _MSC_VER
#define __int8 char
#define __int16 short
#define __int32 int
#define __int64 long long
2002-02-05 18:09:29 +00:00
#endif /* !defined(_MSC_VER) */
typedef signed __int8 INT8, *PINT8;
typedef signed __int16 INT16, *PINT16;
typedef signed __int32 INT32, *PINT32;
typedef signed __int64 INT64, *PINT64;
typedef unsigned __int8 UINT8, *PUINT8;
typedef unsigned __int16 UINT16, *PUINT16;
typedef unsigned __int32 UINT32, *PUINT32;
typedef unsigned __int64 UINT64, *PUINT64;
typedef signed __int32 LONG32, *PLONG32;
typedef unsigned __int32 ULONG32, *PULONG32;
typedef unsigned __int32 DWORD32, *PDWORD32;
typedef signed __int64 LONG64, *PLONG64;
typedef unsigned __int64 ULONG64, *PULONG64;
typedef unsigned __int64 DWORD64, *PDWORD64;
/* Win32 or Win64 dependent typedef/defines. */
#ifdef _WIN64
typedef signed __int64 INT_PTR, *PINT_PTR;
typedef signed __int64 LONG_PTR, *PLONG_PTR;
typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
typedef unsigned __int64 DWORD_PTR, *PDWORD_PTR;
#define MAXINT_PTR 0x7fffffffffffffff
#define MININT_PTR 0x8000000000000000
#define MAXUINT_PTR 0xffffffffffffffff
typedef signed __int32 HALF_PTR, *PHALF_PTR;
typedef unsigned __int32 UHALF_PTR, *PUHALF_PTR;
#define MAXHALF_PTR 0x7fffffff
#define MINHALF_PTR 0x80000000
#define MAXUHALF_PTR 0xffffffff
#else /* FIXME: defined(_WIN32) */
typedef signed __int32 INT_PTR, *PINT_PTR;
typedef signed __int32 LONG_PTR, *PLONG_PTR;
typedef unsigned __int32 UINT_PTR, *PUINT_PTR;
typedef unsigned __int32 ULONG_PTR, *PULONG_PTR;
typedef unsigned __int32 DWORD_PTR, *PDWORD_PTR;
#define MAXINT_PTR 0x7fffffff
#define MININT_PTR 0x80000000
#define MAXUINT_PTR 0xffffffff
typedef signed __int16 HALF_PTR, *PHALF_PTR;
typedef unsigned __int16 UHALF_PTR, *PUHALF_PTR;
#define MAXUHALF_PTR 0xffff
#define MAXHALF_PTR 0x7fff
#define MINHALF_PTR 0x8000
#endif /* defined(_WIN64) || defined(_WIN32) */
typedef INT_PTR SSIZE_T, *PSSIZE_T;
typedef UINT_PTR SIZE_T, *PSIZE_T;
/* Some Wine-specific definitions */
/* Architecture dependent settings. */
/* These are hardcoded to avoid dependencies on config.h in Winelib apps. */
#if defined(__i386__)
# undef WORDS_BIGENDIAN
# undef BITFIELDS_BIGENDIAN
# define ALLOW_UNALIGNED_ACCESS
#elif defined(__sparc__)
# define WORDS_BIGENDIAN
# define BITFIELDS_BIGENDIAN
# undef ALLOW_UNALIGNED_ACCESS
#elif defined(__PPC__)
# define WORDS_BIGENDIAN
# define BITFIELDS_BIGENDIAN
# undef ALLOW_UNALIGNED_ACCESS
#elif !defined(RC_INVOKED)
# error Unknown CPU architecture!
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif /* defined(__cplusplus) */
#endif /* !defined(__WINE_BASETSD_H) */