Closed qcold closed 2 weeks ago
Operand size hints are used in very rare cases (e.g. enter
, leave
) when operand size cannot be determined automatically. See documentation for more details. In your case encoder will determine smallest possible encoding automatically, so if your immediate fits into imm8
, it's the smallest possible encoding, so it's going to be prioritized.
Operand size hints are used in very rare cases (e.g.
enter
,leave
) when operand size cannot be determined automatically. See documentation for more details. In your case encoder will determine smallest possible encoding automatically, so if your immediate fits intoimm8
, it's the smallest possible encoding, so it's going to be prioritized.
could i disable such a feature or should i edit the code?
You can't disable that. API is semantic-driven and encoder is tasked with providing size-optimal output. If you need to fill some extra space e.g. during re-encoding I recommend using ZydisEncoderNopFill
.
How to specify instruction operand size explicitly? I did it with ZYDIS_OPERAND_SIZE_HINT_32, am i right? How can i do that in another way? e.g i wanna encode sub reg, imm32, but i get sub reg, imm8