diff options
| author | Alice Carlotti <alice.carlotti@arm.com> | 2026-04-09 01:45:18 +0100 |
|---|---|---|
| committer | Alice Carlotti <alice.carlotti@arm.com> | 2026-04-09 15:34:46 +0100 |
| commit | 254a4c9a4c64b77cee2613cd056c0237416d735f (patch) | |
| tree | bfd16880927660c420bbe1119619104f60635466 /include | |
| parent | 742abd82d29cca9b7b5a3ff764ae84a9e2943843 (diff) | |
| download | fsf-binutils-gdb-254a4c9a4c64b77cee2613cd056c0237416d735f.tar.gz fsf-binutils-gdb-254a4c9a4c64b77cee2613cd056c0237416d735f.tar.bz2 fsf-binutils-gdb-254a4c9a4c64b77cee2613cd056c0237416d735f.zip | |
aarch64: Cleanup optional_operand_p
Every time I looked at this function I initially misread the
implementation. Make it less confusing.
Diffstat (limited to 'include')
| -rw-r--r-- | include/opcode/aarch64.h | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/include/opcode/aarch64.h b/include/opcode/aarch64.h index e38de9a99dc..79cbed433bb 100644 --- a/include/opcode/aarch64.h +++ b/include/opcode/aarch64.h @@ -1598,16 +1598,13 @@ aarch64_opcode_subclass_p (const aarch64_opcode *opcode, uint64_t flag) return ((opcode->flags & F_SUBCLASS) == flag); } -/* Deal with two possible scenarios: If F_OP_PAIR_OPT not set, as is the case - by default, F_OPDn_OPT must equal IDX + 1, else F_OPDn_OPT must be in range - [IDX, IDX + 1]. */ +/* Return whether OPCODE has an optional operand at position IDX. */ static inline bool optional_operand_p (const aarch64_opcode *opcode, unsigned int idx) { - if (opcode->flags & F_OPD_PAIR_OPT) - return (((opcode->flags >> 12) & 0x7) == idx - || ((opcode->flags >> 12) & 0x7) == idx + 1); - return ((opcode->flags >> 12) & 0x7) == idx + 1; + unsigned int optional_idx = ((opcode->flags >> 12) & 0x7) - 1; + return (idx == optional_idx + || ((opcode->flags & F_OPD_PAIR_OPT) && idx == optional_idx + 1)); } static inline aarch64_insn |
