summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/es5510/es5510.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/es5510/es5510.cpp')
-rw-r--r--src/devices/cpu/es5510/es5510.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/devices/cpu/es5510/es5510.cpp b/src/devices/cpu/es5510/es5510.cpp
index 3d3b080043b..3b2e98f4cca 100644
--- a/src/devices/cpu/es5510/es5510.cpp
+++ b/src/devices/cpu/es5510/es5510.cpp
@@ -102,13 +102,13 @@ inline static int32_t negate(int32_t value) {
}
inline static int32_t asl(int32_t value, int shift, uint8_t &flags) {
- int32_t src24 = value & 0x00ffffff;
- bool carry = ((src24 >> (24 - shift)) & 1) != 0;
- int64_t shifted = util::sext(src24, 24) << shift;
- bool overflow = (shifted > 0x007fffffLL) || (shifted < -0x00800000LL);
- int32_t result = overflow
- ? (shifted < 0 ? 0x00800000 : 0x007fffff)
- : (static_cast<int32_t>(shifted) & 0x00ffffff);
+ const int32_t src24 = value & 0x00ffffff;
+ const bool carry = BIT(src24, 24 - shift);
+ const int64_t shifted = util::sext(src24, 24) << shift;
+ const bool overflow = (shifted > 0x007fffffLL) || (shifted < -0x00800000LL);
+ const int32_t result = overflow
+ ? ((shifted < 0) ? 0x00800000 : 0x007fffff)
+ : (int32_t(shifted) & 0x00ffffff);
flags = setFlagTo(flags, FLAG_C, carry);
flags = setFlagTo(flags, FLAG_V, overflow);