From 084efdeb2d945c5dbdc83cdf0ec93e701a2d56d8 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 5 Dec 2023 16:54:11 -0500 Subject: [PATCH] Resolve further type conversion warnings. --- .../x86/Implementation/ShiftRoll.hpp | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/InstructionSets/x86/Implementation/ShiftRoll.hpp b/InstructionSets/x86/Implementation/ShiftRoll.hpp index abf57ca82..578641a92 100644 --- a/InstructionSets/x86/Implementation/ShiftRoll.hpp +++ b/InstructionSets/x86/Implementation/ShiftRoll.hpp @@ -54,15 +54,16 @@ void rcl( case 0: break; case Numeric::bit_size(): { const IntT temp_carry = destination & 1; - destination = (destination >> 1) | (carry << (Numeric::bit_size() - 1)); + destination = IntT((destination >> 1) | (carry << (Numeric::bit_size() - 1))); carry = temp_carry; } break; default: { const IntT temp_carry = destination & (Numeric::top_bit() >> (temp_count - 1)); - destination = + destination = IntT( (destination << temp_count) | (destination >> (Numeric::bit_size() + 1 - temp_count)) | - (carry << (temp_count - 1)); + (carry << (temp_count - 1)) + ); carry = temp_carry ? 1 : 0; } break; } @@ -103,15 +104,16 @@ void rcr( case 0: break; case Numeric::bit_size(): { const IntT temp_carry = destination & Numeric::top_bit(); - destination = (destination << 1) | carry; + destination = IntT((destination << 1) | carry); carry = temp_carry; } break; default: { const IntT temp_carry = destination & (1 << (temp_count - 1)); - destination = + destination = IntT( (destination >> temp_count) | (destination << (Numeric::bit_size() + 1 - temp_count)) | - (carry << (Numeric::bit_size() - temp_count)); + (carry << (Numeric::bit_size() - temp_count)) + ); carry = temp_carry; } break; } @@ -159,9 +161,10 @@ void rol( return; } if(temp_count) { - destination = + destination = IntT( (destination << temp_count) | - (destination >> (Numeric::bit_size() - temp_count)); + (destination >> (Numeric::bit_size() - temp_count)) + ); } context.flags.template set_from(destination & 1); @@ -210,9 +213,10 @@ void ror( return; } if(temp_count) { - destination = + destination = IntT( (destination >> temp_count) | - (destination << (Numeric::bit_size() - temp_count)); + (destination << (Numeric::bit_size() - temp_count)) + ); } context.flags.template set_from(destination & Numeric::top_bit()); @@ -298,9 +302,9 @@ void sal( context.flags.template set_from( destination & mask ); - context.flags.template set_from( + context.flags.template set_from(IntT( (destination ^ (destination << 1)) & mask - ); + )); destination <<= count; } break; @@ -323,7 +327,7 @@ void sar( destination = sign ? IntT(~0) : IntT(0); context.flags.template set_from(sign); } else { - const IntT mask = 1 << (count - 1); + const auto mask = IntT(1 << (count - 1)); context.flags.template set_from(destination & mask); destination = (destination >> count) | (sign ? ~(IntT(~0) >> count) : 0); } @@ -349,7 +353,7 @@ void shr( context.flags.template set_from(0); destination = 0; } else { - const IntT mask = 1 << (count - 1); + const auto mask = IntT(1 << (count - 1)); context.flags.template set_from(destination & mask); destination >>= count; }