Changed the type of a compiler variable that holds either integers or pointers.

The change allows cc65 to be compiled on 64-bit Windows, without getting warnings.  That OS is actually 32 bits with 64-bit pointers.  Its pointers are "long long" instead of "long".  The change uses type-names that are configured for the actual pointer width.
This commit is contained in:
Greg King
2018-01-08 12:47:00 -05:00
parent da22c90d33
commit c67e90dd19
6 changed files with 35 additions and 34 deletions

View File

@@ -38,29 +38,28 @@
/* If we have stdint.h, include it, otherwise try some quesswork on types.
/* If we have <stdint.h>, include it; otherwise, adapt types from <stddef.h>.
** gcc and msvc don't define __STDC_VERSION__ without special flags, so check
** for them explicitly. Undefined symbols are replaced by zero, so a check for
** defined(__GNUC__) or defined(_MSC_VER) is not necessary.
** for them explicitly. Undefined symbols are replaced by zero; so, checks for
** defined(__GNUC__) and defined(_MSC_VER) aren't necessary.
*/
#if (__STDC_VERSION__ >= 199901) || (__GNUC__ >= 3) || (_MSC_VER >= 1600)
#include <stdint.h>
#else
/* Assume long is the largest type available, and assume that pointers can be
** safely converted into this type and back.
/* Assume that ptrdiff_t and size_t are wide enough to hold pointers.
** Assume that they are the widest type.
*/
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long intmax_t;
typedef unsigned long uintmax_t;
#include <stddef.h>
typedef ptrdiff_t intptr_t;
typedef size_t uintptr_t;
typedef ptrdiff_t intmax_t;
typedef size_t uintmax_t;
#endif
/* End of inttypes.h */
#endif