From 8e56088c6ff6ddb3add7695b1b8652b8969d37c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Thu, 6 Jan 2022 01:08:44 +0100 Subject: [PATCH] encode: Fix OPC_*_MSK on 32-bit systems Where we'd end up losing the upper bits. GCC catches this and emits a warning such as: warning: result of '7 << 31' requires 35 bits to represent, but 'long int' only has 32 bits [-Wshift-overflow=] --- encode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/encode.c b/encode.c index 53888cc..bebbead 100644 --- a/encode.c +++ b/encode.c @@ -31,9 +31,9 @@ enum { }; #define OPC_SEG_IDX 31 -#define OPC_SEG_MSK (0x7l << OPC_SEG_IDX) +#define OPC_SEG_MSK ((uint64_t) 0x7l << OPC_SEG_IDX) #define OPC_VEXOP_IDX 34 -#define OPC_VEXOP_MSK (0xfl << OPC_VEXOP_IDX) +#define OPC_VEXOP_MSK ((uint64_t) 0xfl << OPC_VEXOP_IDX) static bool op_mem(FeOp op) { return op < 0; } static bool op_reg(FeOp op) { return op >= 0; }