Fix warning about negative shifts. (#2171)

This commit is contained in:
Rot127 2023-09-24 03:10:29 +00:00 committed by GitHub
parent cb4bf3c5d3
commit 322fde9205
2 changed files with 3 additions and 3 deletions

View File

@ -28,7 +28,7 @@ project(capstone
if (MSVC)
add_compile_options(/W1 /w14189)
else()
add_compile_options(-Werror -Wreturn-type -Wformat -Wmissing-braces -Wunused-function -Warray-bounds -Wunused-variable -Wparentheses -Wint-in-bool-context -Wmisleading-indentation)
add_compile_options(-Werror -Wshift-negative-value -Wreturn-type -Wformat -Wmissing-braces -Wunused-function -Warray-bounds -Wunused-variable -Wparentheses -Wint-in-bool-context -Wmisleading-indentation)
endif()

View File

@ -808,7 +808,7 @@ DEFINE_printAddrMode5Operand(false) DEFINE_printAddrMode5Operand(true)
printRegName(O, MCOperand_getReg(MO1));
if (MCOperand_getImm(MO2)) {
SStream_concat(O, "%s", ":");
printInt64(O, ((int32_t)MCOperand_getImm(MO2)) << 3);
printInt64(O, ((uint32_t)MCOperand_getImm(MO2)) << 3);
}
SStream_concat(O, "%s", "]");
SStream_concat0(O, markup(">"));
@ -1177,7 +1177,7 @@ void printPCLabel(MCInst *MI, unsigned OpNum, SStream *O)
return; \
} \
\
int32_t OffImm = (int32_t)MCOperand_getImm(MO) << scale; \
int32_t OffImm = (uint32_t)MCOperand_getImm(MO) << scale; \
\
SStream_concat0(O, markup("<imm:")); \
if (OffImm == INT32_MIN) \