1
0
Fork 0

Detect sizeof the dosbox data types

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1771
This commit is contained in:
Sjoerd van der Berg 2004-04-20 06:53:36 +00:00
parent 67253f9e9b
commit c1a88974e0
4 changed files with 66 additions and 21 deletions

View file

@ -305,7 +305,7 @@ AC_SUBST(ALSA_LIBS)
AH_TOP([
/*
* Copyright (C) 2002-2003 The DOSBox Team
* Copyright (C) 2002-2004 The DOSBox Team
*
* 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
@ -331,4 +331,49 @@ AH_BOTTOM([#if C_HAS_ATTRIBUTE
#define GCC_ATTRIBUTE(x) /* attribute not supported */
#endif])
AH_BOTTOM([
typedef double Real64;
#if SIZEOF_UNSIGNED_CHAR != 1
# error "sizeof (unsigned char) != 1"
#else
typedef unsigned char Bit8u;
typedef signed char Bit8s;
#endif
#if SIZEOF_UNSIGNED_SHORT != 2
# error "sizeof (unsigned short) != 2"
#else
typedef unsigned short Bit16u;
typedef signed short Bit16s;
#endif
#if SIZEOF_UNSIGNED_INT == 4
typedef unsigned int Bit32u;
typedef signed int Bit32s;
#elif SIZEOF_UNSIGNED_LONG == 4
typedef unsigned long Bit32u;
typedef signed long Bit32s;
#else
# error "can't find sizeof(type) of 4 bytes!"
#endif
#if SIZEOF_UNSIGNED_LONG == 8
typedef unsigned long Bit64u;
typedef signed long Bit64s;
#elif SIZEOF_UNSIGNED_LONG_LONG == 8
typedef unsigned long long Bit64u;
typedef signed long long Bit64s;
#else
# error "can't find data type of 8 bytes"
#endif
#if SIZEOF_INT_P == 4
typedef Bit32u Bitu;
typedef Bit32s Bits;
#else
typedef Bit64u Bitu;
typedef Bit64s Bits;
#endif
])

View file

@ -35,7 +35,12 @@ AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_STRUCT_TM
AC_CHECK_SIZEOF(unsigned char)
AC_CHECK_SIZEOF(unsigned short)
AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(unsigned long long)
AC_CHECK_SIZEOF(int *)
AC_MSG_CHECKING(if environ can be included)
AC_TRY_LINK([#include <unistd.h>

View file

@ -24,25 +24,6 @@ void E_Exit(char * message,...);
void MSG_Add(const char*,const char*); //add messages to the internal langaugefile
const char* MSG_Get(char const *); //get messages from the internal langaugafile
/* The internal types */
typedef unsigned char Bit8u;
typedef signed char Bit8s;
typedef unsigned short Bit16u;
typedef signed short Bit16s;
typedef unsigned long Bit32u;
typedef signed long Bit32s;
typedef double Real64;
#if defined(_MSC_VER)
typedef unsigned __int64 Bit64u;
typedef signed __int64 Bit64s;
#else
typedef unsigned long long Bit64u;
typedef signed long long Bit64s;
#endif
typedef unsigned int Bitu;
typedef signed int Bits;
#include <stddef.h>
#include "config.h"

View file

@ -39,3 +39,17 @@
#define ENVIRON_LINKED 1
#define GCC_ATTRIBUTE(x) /* attribute not supported */
typedef double Real64;
/* The internal types */
typedef unsigned char Bit8u;
typedef signed char Bit8s;
typedef unsigned short Bit16u;
typedef signed short Bit16s;
typedef unsigned long Bit32u;
typedef signed long Bit32s;
typedef unsigned __int64 Bit64u;
typedef signed __int64 Bit64s;
typedef unsigned int Bitu;
typedef signed int Bits;