basetsd.h revision 930b5f872e89407f445d4000d4e4aaecaa6a0998
/*
* Compilers that uses ILP32, LP64 or P64 type models
* for both Win32 and Win64 are supported by this file.
*
* Copyright (C) 1999 Patrik Stridvall
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Oracle elects to use only
* the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
* a choice of LGPL license versions is made available with the language indicating
* that LGPLv2 or any later version may be used, or where a choice of which version
* of the LGPL is applied is otherwise unspecified.
*/
#ifndef __WINE_BASETSD_H
#define __WINE_BASETSD_H
#ifdef __cplusplus
extern "C" {
#endif /* defined(__cplusplus) */
/*
* Win32 was easy to implement under Unix since most 32-bit Unices use the same
* type model (ILP32) as Win32, where int, long and pointer are 32-bit.
*
* Win64, however, can cause some problems. Most 64-bit Unices use the LP64 type
* model where int is 32-bit and long and pointer are 64-bit. Win64 on the other
* hand uses the LLP64 type model where int and long are 32 bit and pointer is
* 64-bit.
*/
#if (defined(__x86_64__) || defined(__powerpc64__) || defined(__sparc64__) || defined(__aarch64__)) && !defined(_WIN64)
#define _WIN64
#endif
/* Type model independent typedefs */
/* The __intXX types are native types defined by the MS C compiler.
* Apps that make use of them before they get defined here, can
* simply add to the command line:
* -D__int8=char -D__int16=short -D__int32=int "-D__int64=long long"
*/
# ifndef __int8
# define __int8 char
# endif
# ifndef __int16
# define __int16 short
# endif
# ifndef __int32
# define __int32 int
# endif
# ifndef __int64
# if defined(_WIN64) && !defined(__MINGW64__)
# define __int64 long
# else
# define __int64 long long
# endif
# endif
#endif /* !defined(_MSC_VER) */
/* FIXME: DECLSPEC_ALIGN should be declared only in winnt.h, but we need it here too */
#ifndef DECLSPEC_ALIGN
# else
# define DECLSPEC_ALIGN(x)
# endif
#endif
#ifdef _MSC_VER
#else
#endif
/* Basic pointer-sized integer types */
#else
typedef unsigned long ULONG_PTR, *PULONG_PTR;
#endif
#ifdef _WIN64
#define MAXINT_PTR 0x7fffffffffffffff
#define MININT_PTR 0x8000000000000000
#define MAXUINT_PTR 0xffffffffffffffff
typedef __int64 SHANDLE_PTR;
typedef unsigned __int64 HANDLE_PTR;
typedef unsigned int UHALF_PTR, *PUHALF_PTR;
#define MAXHALF_PTR 0x7fffffff
#define MINHALF_PTR 0x80000000
#define MAXUHALF_PTR 0xffffffff
static inline ULONG32 HandleToULong(const void *h)
{
}
static inline LONG32 HandleToLong(const void *h)
{
}
{
}
static inline void *LongToHandle(LONG32 l)
{
return (void *)(LONG_PTR)l;
}
static inline ULONG32 PtrToUlong(const void *p)
{
}
{
}
{
}
{
}
static inline UINT16 PtrToUshort(const void *p)
{
}
static inline INT16 PtrToShort(const void *p)
{
}
{
return (void *)(INT_PTR)i;
}
{
}
{
return (void *)(LONG_PTR)l;
}
{
}
#endif /* !__midl && !__WIDL__ */
#else /* FIXME: defined(_WIN32) */
#define MAXINT_PTR 0x7fffffff
#define MININT_PTR 0x80000000
#define MAXUINT_PTR 0xffffffff
typedef long SHANDLE_PTR;
typedef unsigned long HANDLE_PTR;
typedef unsigned short UHALF_PTR, *PUHALF_PTR;
#define MAXUHALF_PTR 0xffff
#define MAXHALF_PTR 0x7fff
#define MINHALF_PTR 0x8000
#endif /* defined(_WIN64) || defined(_WIN32) */
#define HandleToUlong(h) HandleToULong(h)
/* Some Wine-specific definitions */
/* Architecture dependent settings. */
/* These are hardcoded to avoid dependencies on config.h in Winelib apps. */
#if defined(__i386__)
# define ALLOW_UNALIGNED_ACCESS
#elif defined(__x86_64__)
# define ALLOW_UNALIGNED_ACCESS
# define WORDS_BIGENDIAN
# define BITFIELDS_BIGENDIAN
#elif defined(__powerpc__)
# define WORDS_BIGENDIAN
# define BITFIELDS_BIGENDIAN
# define WORDS_BIGENDIAN
# define BITFIELDS_BIGENDIAN
#elif defined(__AARCH64EB__)
# define WORDS_BIGENDIAN
# define BITFIELDS_BIGENDIAN
#elif defined(__MIPSEB__)
# define WORDS_BIGENDIAN
# define BITFIELDS_BIGENDIAN
#elif defined(__MIPSEL__)
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif /* defined(__cplusplus) */
#endif /* !defined(__WINE_BASETSD_H) */