diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-01-20 00:39:43 +0000 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-01-20 00:39:43 +0000 |
commit | 7d986adf37220e1981a707745b784b078de4e3bc (patch) | |
tree | 831dea5f470c0c6b3c373f38d3a5f0354bc22600 /includes/compiler/common.h | |
parent | 4d670146b4054e11e90227f96a3a1c66410e8d0b (diff) | |
download | MWCC-7d986adf37220e1981a707745b784b078de4e3bc.tar.gz MWCC-7d986adf37220e1981a707745b784b078de4e3bc.zip |
fix various inaccuracies exposed by the mach ppc plugin
Diffstat (limited to 'includes/compiler/common.h')
-rw-r--r-- | includes/compiler/common.h | 13 |
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 |