Skip to content

Commit 489244a

Browse files
committed
Add store_through_chain
1 parent 8bab07e commit 489244a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pythonbpf/binary_ops.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ def get_operand_value(operand, builder, local_sym_tab):
4343
raise TypeError(f"Unsupported operand type: {type(operand)}")
4444

4545

46+
def store_through_chain(value, chain, builder):
47+
"""Store a value through a pointer chain."""
48+
if not chain or len(chain) < 2:
49+
raise ValueError("Pointer chain must have at least two elements")
50+
51+
for ptr in reversed(chain[1:]):
52+
builder.store(value, ptr)
53+
value = ptr
54+
55+
4656
def handle_binary_op_impl(rval, builder, local_sym_tab):
4757
op = rval.op
4858
left, _, _ = get_operand_value(rval.left, builder, local_sym_tab)

0 commit comments

Comments
 (0)