diff options
author | Aurelien Jarno <aurelien@aurel32.net> | 2015-05-25 01:28:56 +0200 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2015-06-12 12:02:48 +0200 |
commit | 5ed9a259c164bb9fd2a6fe8a363a4bda2e4a5461 (patch) | |
tree | 16aad439a363352e18a52243f82d5fb3789344be /target-sh4/op_helper.c | |
parent | 563807520ff19e6ed2d40695f543f1fba7ba432f (diff) |
target-sh4: use bit number for SR constants
Use the bit number for SR constants instead of using a bit mask. This
make possible to also use the constants for shifts.
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'target-sh4/op_helper.c')
-rw-r--r-- | target-sh4/op_helper.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/target-sh4/op_helper.c b/target-sh4/op_helper.c index 74a5c4ea77..6f34292a99 100644 --- a/target-sh4/op_helper.c +++ b/target-sh4/op_helper.c @@ -156,15 +156,15 @@ void helper_ocbi(CPUSH4State *env, uint32_t address) } } -#define T (env->sr & SR_T) -#define Q (env->sr & SR_Q ? 1 : 0) -#define M (env->sr & SR_M ? 1 : 0) -#define SETT env->sr |= SR_T -#define CLRT env->sr &= ~SR_T -#define SETQ env->sr |= SR_Q -#define CLRQ env->sr &= ~SR_Q -#define SETM env->sr |= SR_M -#define CLRM env->sr &= ~SR_M +#define T (env->sr & (1u << SR_T)) +#define Q (env->sr & (1u << SR_Q) ? 1 : 0) +#define M (env->sr & (1u << SR_M) ? 1 : 0) +#define SETT (env->sr |= (1u << SR_T)) +#define CLRT (env->sr &= ~(1u << SR_T)) +#define SETQ (env->sr |= (1u << SR_Q)) +#define CLRQ (env->sr &= ~(1u << SR_Q)) +#define SETM (env->sr |= (1u << SR_M)) +#define CLRM (env->sr &= ~(1u << SR_M)) uint32_t helper_div1(CPUSH4State *env, uint32_t arg0, uint32_t arg1) { @@ -282,7 +282,7 @@ void helper_macl(CPUSH4State *env, uint32_t arg0, uint32_t arg1) res += (int64_t) (int32_t) arg0 *(int64_t) (int32_t) arg1; env->mach = (res >> 32) & 0xffffffff; env->macl = res & 0xffffffff; - if (env->sr & SR_S) { + if (env->sr & (1u << SR_S)) { if (res < 0) env->mach |= 0xffff0000; else @@ -298,7 +298,7 @@ void helper_macw(CPUSH4State *env, uint32_t arg0, uint32_t arg1) res += (int64_t) (int16_t) arg0 *(int64_t) (int16_t) arg1; env->mach = (res >> 32) & 0xffffffff; env->macl = res & 0xffffffff; - if (env->sr & SR_S) { + if (env->sr & (1u << SR_S)) { if (res < -0x80000000) { env->mach = 1; env->macl = 0x80000000; @@ -311,12 +311,12 @@ void helper_macw(CPUSH4State *env, uint32_t arg0, uint32_t arg1) static inline void set_t(CPUSH4State *env) { - env->sr |= SR_T; + env->sr |= (1u << SR_T); } static inline void clr_t(CPUSH4State *env) { - env->sr &= ~SR_T; + env->sr &= ~(1u << SR_T); } void helper_ld_fpscr(CPUSH4State *env, uint32_t val) |