Skip to content

Commit a718cfb

Browse files
committed
Remove some code repetition
1 parent 772f803 commit a718cfb

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

Tools/cases_generator/analyzer.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,7 @@ def get_instruction_size_for_uop(instructions: dict[str, Instruction], uop: Uop)
10921092
If there is more than one instruction that contains the uop,
10931093
ensure that they all have the same size.
10941094
"""
1095-
if not any(is_instruction_size_macro(token) for token in uop.body):
1095+
if not (token := next((t for t in uop.body if is_instruction_size_macro(t)), None)):
10961096
return None
10971097

10981098
size = None
@@ -1101,14 +1101,12 @@ def get_instruction_size_for_uop(instructions: dict[str, Instruction], uop: Uop)
11011101
if size is None:
11021102
size = inst.size
11031103
if size != inst.size:
1104-
token = next(t for t in uop.body if is_instruction_size_macro(t))
11051104
raise analysis_error(
11061105
"All instructions containing a uop with the `INSTRUCTION_SIZE` macro "
11071106
f"must have the same size: {size} != {inst.size}",
11081107
token
11091108
)
11101109
if size is None:
1111-
token = next(t for t in uop.body if is_instruction_size_macro(t))
11121110
raise analysis_error(f"No instruction containing the uop '{uop.name}' was found", token)
11131111
return size
11141112

0 commit comments

Comments
 (0)