Add SIZEOF_{SHORT,INT,LONGLONG,PTHREAD_T} (GH PR #20)

This commit is contained in:
Emil Rosenquist 2022-09-01 09:14:59 +02:00 committed by Boris Kolpackov
parent 7d2082cbb2
commit 0364b16e8c
4 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,16 @@
// SIZEOF_INT
#undef SIZEOF_INT
#ifdef _MSC_VER
# define SIZEOF_INT 4
#else
/* Both GCC and Clang (and maybe others) define __SIZEOF_INT__. */
# ifdef __SIZEOF_INT__
# define SIZEOF_INT __SIZEOF_INT__
# endif
#endif
#ifndef SIZEOF_INT
# error unable to determine size of int
#endif

View File

@ -0,0 +1,16 @@
// SIZEOF_LONG_LONG
#undef SIZEOF_LONG_LONG
#ifdef _MSC_VER
# define SIZEOF_LONG_LONG 8
#else
/* Both GCC and Clang (and maybe others) define __SIZEOF_LONG_LONG__. */
# ifdef __SIZEOF_LONG_LONG__
# define SIZEOF_LONG_LONG __SIZEOF_LONG_LONG__
# endif
#endif
#ifndef SIZEOF_LONG_LONG
# error unable to determine size of long long
#endif

View File

@ -0,0 +1,15 @@
// SIZEOF_PTHREAD_T
#undef SIZEOF_PTHREAD_T
#ifndef _WIN32
# ifdef defined(__APPLE__)
# ifdef __LP64__
# define SIZEOF_PTHREAD_T 8
# else
# define SIZEOF_PTHREAD_T 4
# endif
# else
# define SIZEOF_PTHREAD_T 4
# endif
#endif

View File

@ -0,0 +1,16 @@
// SIZEOF_SHORT
#undef SIZEOF_SHORT
#ifdef _MSC_VER
# define SIZEOF_SHORT 2
#else
/* Both GCC and Clang (and maybe others) define __SIZEOF_SHORT__. */
# ifdef __SIZEOF_SHORT__
# define SIZEOF_SHORT __SIZEOF_SHORT__
# endif
#endif
#ifndef SIZEOF_SHORT
# error unable to determine size of short
#endif