X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=mach.c;h=e8a719bce782baef14c7775692ee96ee634b50be;hp=2da58ec74a9614918e2f723fb64eb2cb6eff4ed8;hb=ff8188b7e279f99cf11ac8a283c4146af324d26f;hpb=cfd001aea60f54e49d9beae0f941c513f45c202b diff --git a/mach.c b/mach.c index 2da58ec..e8a719b 100644 --- a/mach.c +++ b/mach.c @@ -822,10 +822,12 @@ int m_move(WORD inst, WORD size) int siz = (int)size; // Try to optimize to MOVEQ + // N.B.: We can get away with casting the uint64_t to a 32-bit value + // because it checks for a SIZL (i.e., a 32-bit value). if (CHECK_OPTS(OPT_MOVEL_MOVEQ) && (siz == SIZL) && (am0 == IMMED) && (am1 == DREG) && ((a0exattr & (TDB | DEFINED)) == DEFINED) - && (a0exval + 0x80 < 0x100)) + && ((uint32_t)a0exval + 0x80 < 0x100)) { m_moveq((WORD)0x7000, (WORD)0); @@ -979,7 +981,7 @@ int m_br(WORD inst, WORD siz) return error(rel_error); //} - v = a0exval - (sloc + 2); + v = (uint32_t)a0exval - (sloc + 2); // Optimize branch instr. size if (siz == SIZN) @@ -1105,7 +1107,7 @@ int m_trap(WORD inst, WORD siz) // int m_movem(WORD inst, WORD siz) { - uint32_t eval; + uint64_t eval; WORD i; WORD w; WORD rmask; @@ -1251,7 +1253,6 @@ int m_br30(WORD inst, WORD siz) // int m_bfop(WORD inst, WORD siz) { - if ((bfval1 > 31) || (bfval1 < 0)) return error("bfxxx offset: immediate value must be between 0 and 31"); @@ -1280,7 +1281,7 @@ int m_bfop(WORD inst, WORD siz) bfparam1 = bfval1 << 12; } - D_word((inst|am0|a0reg|am1|a1reg)); + D_word((inst | am0 | a0reg | am1 | a1reg)); ea0gen(siz); // Generate EA // Second instruction word - Dest register (if exists), Do, Offset, Dw, Width