From 77cea8730a4a629d31192d55c9ef63a3a6c93680 Mon Sep 17 00:00:00 2001 From: Themis Demetriades Date: Thu, 6 Jun 2024 13:47:01 +0100 Subject: [PATCH] Fix getMSB function to only return 0 or 1 --- src/execute.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/execute.c b/src/execute.c index 1f37999..428e661 100644 --- a/src/execute.c +++ b/src/execute.c @@ -86,7 +86,7 @@ inline static dword getMSBPos(a64inst_regType regType) { // Returns the MSB of the given value assuming it's of the size stored in the given register type inline static uint8_t getMSB(dword value, a64inst_regType regType) { - return value >> getMSBPos(regType); + return (value >> getMSBPos(regType)) & 1u; } // Updates N and Z condition codes given the machine and a result value