Define _EM_LLSIZE, int64_t, uint64_t for linux386.

Also change UINT32_MAX in <stdint.h> from 4294967295 to 4294967295U.
The U suffix avoids a promotion to long or unsigned long if it would
fit in unsigned int.

Define _EM_LLSIZE but not EM_LLSIZE.  The leading underscore is a
convention for such macros.  If code always uses _EM_LLSIZE, we will
never need to add EM_LLSIZE.  The flag -D_EM_LLSIZE={q} is in
plat/linux386/descr, not lib/descr/fe, so platforms without long long
don't define _EM_LLSIZE.

<stdint.h> doesn't keep the old code for _EM_LSIZE == 8, because I
change it to _EM_LLSIZE == 8.  No platform had _EM_LSIZE == 8, and the
old limits like INT64_MAX were wrong.
This commit is contained in:
George Koehler 2019-09-12 13:40:07 -04:00
parent eb0d5e1d6c
commit aeb8ed53e4
2 changed files with 12 additions and 10 deletions

View file

@ -33,16 +33,16 @@ typedef unsigned long uint32_t;
#endif
#define INT32_MAX 2147483647
#define INT32_MIN (-2147483648)
#define UINT32_MAX 4294967295
#define UINT32_MAX 4294967295U
/* We only get int64_t if longs are 8 bytes. */
/* We only get int64_t if long longs are 8 bytes. */
#if _EM_LSIZE == 8
typedef signed long int64_t;
typedef unsigned long uint64_t;
#define INT64_MAX 2147483647LL
#define INT64_MIN (-2147483648LL)
#define UINT64_MAX 4294967295ULL
#if _EM_LLSIZE == 8
typedef signed long long int64_t;
typedef unsigned long long uint64_t;
#define INT64_MAX 9223372036854775807LL
#define INT64_MIN (-9223372036854775808LL)
#define UINT64_MAX 18446744073709551615ULL
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;

View file

@ -10,6 +10,8 @@ var s=2
var sa={s}
var l={w}
var la={w}
var q=8
var qa=4
var f={w}
var fa={w}
var d=8
@ -19,12 +21,12 @@ var xa={x}
var ARCH=i386
var PLATFORM=linux386
var PLATFORMDIR={EM}/share/ack/{PLATFORM}
var CPP_F=-D__unix
var CPP_F=-D__unix -D_EM_LLSIZE={q}
var ALIGN=-a0:4 -a1:4 -a2:4 -a3:4 -b0:0x08048054
var C_LIB={PLATFORMDIR}/libc-ansi.a
# bitfields reversed for compatibility with (g)cc.
# long long enabled.
var CC_ALIGN=-Vrq8.4
var CC_ALIGN=-Vrq{q}.{qa}
var OLD_C_LIB={C_LIB}
var MACHOPT_F=-m10
var EGO_PLAT_FLAGS=-M{EM}/share/ack/ego/{ARCH}.descr