Repository: NationalSecurityAgency/ghidra
File: Ghidra/Features/Decompiler/src/decompile/cpp/types.h (C/C++)

Code before:
typedef size_t uintm;
#if INT64_MAX == LONG_MAX
typedef long intm;
#else
typedef int intm;
#endif
typedef uint64_t uint8;
typedef int64_t int8;
typedef uint32_t uint4;
typedef int32_t int4;
typedef uint16_t uint2;
typedef int16_t int2;
typedef uint8_t uint1;
typedef int8_t int1;
typedef uintptr_t uintp;

#if defined( __sparc )
#define HOST_ENDIAN 1
#endif /* __sparc */

/* Alpha defines */
#if defined (__digital__) && defined (__unix__)
#endif

#if defined (__linux__) && defined (__i386__)
#define HOST_ENDIAN 0
#endif

#if defined (__linux__) && defined (__x86_64__)
#define HOST_ENDIAN 0
#endif

#if defined(_WINDOWS)

#if defined(_WIN64)

#define HOST_ENDIAN 0

#else // _WIN32 assumed

#define HOST_ENDIAN 0
#endif // _WIN32

#endif // _WINDOWS

#if defined( __APPLE_CC__) && defined( __ppc__)
#define HOST_ENDIAN 1
#endif

#if defined( __APPLE_CC__) && defined( __i386__)
#define HOST_ENDIAN 0

Review comment (suggestion):
I think with this change we can go further and just set `HOST_ENDIAN 0` by default, and set it to `1` only in a few cases, can be combined into the one `ifdef`.

Code after:
typedef size_t uintm;
typedef std::make_signed<uintm>::type intm;
typedef uint64_t uint8;
typedef int64_t int8;
typedef uint32_t uint4;
typedef int32_t int4;
typedef uint16_t uint2;
typedef int16_t int2;
typedef uint8_t uint1;
typedef int8_t int1;
typedef uintptr_t uintp;

#if defined(_WINDOWS)
#pragma warning (disable:4312)
#pragma warning (disable:4311)
#pragma warning (disable:4267)
#pragma warning (disable:4018)
#pragma warning (disable:4244)

/*
 The windows standard template library list implementation seems to have a philosophical difference with
 the standard regarding the validity of iterators pointing to objects that are moved between containers
 (via the splice method) These defines turn off the validity checks
 (These have been moved to the VC project spec)
 */
//#define _SECURE_SCL 0
//#define _HAS_ITERATOR_DEBUGGING 0
#endif

/* In order to have a little more flexibility in integer precision vs efficiency,
  we subdivide the integer types into three classes:

  Small integers:   Integers that never come close to overflowing their (machine word)
                    precision. We will always use int4 or uint4 (or smaller) for
                    these so that the precision is explicitly given.

  Machine word integers:   These integers exactly match the largest precision that
                           will fit in a general purpose register.  They should be
                           used exclusively by in implementations of larger
                           precision objects.  Use intm or uintm

  Big integers: These are intended to be arbitrary precison integers. However
                for efficiency, these will always be implemented as fixed precision.
                So for coding purposes, these should be interpreted as fixed
                precision integers that store as big a number as you would ever need.
*/

/* Specify that unsigned big ints are coded with 8 bytes */
#define UINTB8

typedef int8 intb;		/* This is a signed big integer */