summaryrefslogtreecommitdiff
path: root/includes/compiler/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'includes/compiler/common.h')
-rw-r--r--includes/compiler/common.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/includes/compiler/common.h b/includes/compiler/common.h
index fc5e84e..ed5b25a 100644
--- a/includes/compiler/common.h
+++ b/includes/compiler/common.h
@@ -3,6 +3,8 @@
#include "cw_common.h"
+enum { CR = 13, LF = 10 };
+
typedef struct HashNameNode {
struct HashNameNode *next;
SInt32 id;
@@ -326,9 +328,18 @@ struct CompilerLinkerParamBlk {
#define FITS_IN_USHORT(value) ( (value) == ((unsigned short) (value)) )
#define FITS_IN_HI_SHORT(value) ( (value) == (value & 0xFFFF0000) )
#define FITS_IN_SHORT2(value) ( ((short) (value)) == (value) )
-#define HIGH_PART(value) ( (short) (((value) >> 16) + (((value) & 0x8000) >> 15)) )
+#define HIGH_PART(value) ( (short) (((value) >> 16) + (((value) >> 15) & 1)) )
#define LOW_PART(value) ( (short) (value) )
+// The PowerPC code generator has a bug which breaks the PowerPC code generator,
+// causing 32-bit value loads to emit "addi x, y, 0" even if the lower 16 bits are
+// zero. This define simulates that behaviour on other platforms
+#ifdef CW_REPLICATE_PPC_CODEGEN_BUG
+#define LOW_PART_BUGGY(value) (value)
+#else
+#define LOW_PART_BUGGY(value) ( (short) (value) )
+#endif
+
#ifdef __MWERKS__
#pragma options align=reset
#endif