Additional adjustments

This commit is contained in:
caheckman 2021-10-14 13:49:35 -04:00
parent f1a8123547
commit 5ec6cfcd81
2 changed files with 15 additions and 41 deletions

View file

@ -14,8 +14,6 @@
* limitations under the License. * limitations under the License.
*/ */
import java.nio.ByteOrder
// Native build files are already applied in development mode (indicated by presence of the // Native build files are already applied in development mode (indicated by presence of the
// Generic project). Only need to apply them if we are in a distribution. // Generic project). Only need to apply them if we are in a distribution.
if (findProject(':Generic') == null) { if (findProject(':Generic') == null) {
@ -24,13 +22,6 @@ if (findProject(':Generic') == null) {
apply from: "../../../GPL/nativeBuildProperties.gradle" apply from: "../../../GPL/nativeBuildProperties.gradle"
} }
def getHostEndianDefine() {
if (ByteOrder.nativeOrder().equals(ByteOrder.BIG_ENDIAN)) {
return "HOST_ENDIAN=1"
}
return "HOST_ENDIAN=0"
}
/** /**
* Define the "native build model" for building the decompiler executables. * Define the "native build model" for building the decompiler executables.
*/ */
@ -196,7 +187,6 @@ model {
binaries { binaries {
all{ b -> all{ b ->
b.cppCompiler.define getHostEndianDefine()
if (b.toolChain in Gcc) { if (b.toolChain in Gcc) {
b.cppCompiler.args "-std=c++11" b.cppCompiler.args "-std=c++11"
b.cppCompiler.args "-Wall" b.cppCompiler.args "-Wall"

View file

@ -16,20 +16,15 @@
*/ */
/* typedefs for getting specific word sizes */ /* typedefs for getting specific word sizes */
/* Defines for the "preferred" intm size, where this is not determined by the */
/* algorithm being coded. I.e. the code works without change using */
/* maximum wordsize when compiled on 64 OR 32 machines */
/* uintp is intended to be an unsigned integer that is the same size as a pointer */
#ifndef __MYTYPES__ #ifndef __MYTYPES__
#define __MYTYPES__ #define __MYTYPES__
#include <cstdint> #include <cstdint>
#include <type_traits>
typedef size_t uintm; // Use of uintm and intm is deprecated. They must currently be set to be 32-bit.
typedef std::make_signed<uintm>::type intm; typedef uint32_t uintm;
typedef int32_t intm;
typedef uint64_t uint8; typedef uint64_t uint8;
typedef int64_t int8; typedef int64_t int8;
typedef uint32_t uint4; typedef uint32_t uint4;
@ -38,8 +33,16 @@ typedef uint16_t uint2;
typedef int16_t int2; typedef int16_t int2;
typedef uint8_t uint1; typedef uint8_t uint1;
typedef int8_t int1; typedef int8_t int1;
/* uintp is intended to be an unsigned integer that is the same size as a pointer */
typedef uintptr_t uintp; typedef uintptr_t uintp;
class Endian {
public:
static constexpr const union { int4 whole; int1 part[4]; } host = { 1 };
};
#define HOST_ENDIAN Endian::host.part[3]
#if defined(_WINDOWS) #if defined(_WINDOWS)
#pragma warning (disable:4312) #pragma warning (disable:4312)
#pragma warning (disable:4311) #pragma warning (disable:4311)
@ -57,34 +60,15 @@ typedef uintptr_t uintp;
//#define _HAS_ITERATOR_DEBUGGING 0 //#define _HAS_ITERATOR_DEBUGGING 0
#endif #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 Big integers: These are intended to be arbitrary precison integers. However
for efficiency, these will always be implemented as fixed precision. for efficiency, these are currently implemented as fixed precision.
So for coding purposes, these should be interpreted as fixed So for coding purposes, these should be interpreted as fixed
precision integers that store as big a number as you would ever need. 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 */ typedef int8 intb; /* This is a signed big integer */
//#include "integer.hh"
#ifdef UINTB8
typedef uint8 uintb; /* This is an unsigned big integer */ typedef uint8 uintb; /* This is an unsigned big integer */
#else
typedef uint4 uintb;
#endif
/* /*