Skip to content

Commit d1055e4

Browse files
committed
Reduce a condition from handle_cond
1 parent 28ce14c commit d1055e4

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

pythonbpf/functions/functions_pass.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,7 @@ def handle_assign(
242242

243243
def handle_cond(func, module, builder, cond, local_sym_tab, map_sym_tab):
244244
if isinstance(cond, ast.Constant):
245-
if isinstance(cond.value, bool):
246-
return ir.Constant(ir.IntType(1), int(cond.value))
247-
elif isinstance(cond.value, int):
245+
if isinstance(cond.value, bool) or isinstance(cond.value, int):
248246
return ir.Constant(ir.IntType(1), int(bool(cond.value)))
249247
else:
250248
logger.info("Unsupported constant type in condition")

0 commit comments

Comments
 (0)