mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
Reduce a condition from handle_cond
This commit is contained in:
@ -242,9 +242,7 @@ def handle_assign(
|
|||||||
|
|
||||||
def handle_cond(func, module, builder, cond, local_sym_tab, map_sym_tab):
|
def handle_cond(func, module, builder, cond, local_sym_tab, map_sym_tab):
|
||||||
if isinstance(cond, ast.Constant):
|
if isinstance(cond, ast.Constant):
|
||||||
if isinstance(cond.value, bool):
|
if isinstance(cond.value, bool) or isinstance(cond.value, int):
|
||||||
return ir.Constant(ir.IntType(1), int(cond.value))
|
|
||||||
elif isinstance(cond.value, int):
|
|
||||||
return ir.Constant(ir.IntType(1), int(bool(cond.value)))
|
return ir.Constant(ir.IntType(1), int(bool(cond.value)))
|
||||||
else:
|
else:
|
||||||
logger.info("Unsupported constant type in condition")
|
logger.info("Unsupported constant type in condition")
|
||||||
|
|||||||
Reference in New Issue
Block a user