Skip to content
Snippets Groups Projects
Commit b03ab780 authored by Martin Teichmann's avatar Martin Teichmann
Browse files

ebpf can actually only do floor div

as Python makes a difference here, follow its logic and call
floor division as such.
parent 435faaa1
No related branches found
No related tags found
No related merge requests found
......@@ -439,8 +439,8 @@ class Expression:
__sub__ = binary(Opcode.SUB)
__rsub__ = rbinary(Opcode.SUB)
__rmul__ = __mul__ = binary(Opcode.MUL)
__truediv__ = binary(Opcode.DIV)
__rtruediv__ = rbinary(Opcode.DIV)
__floordiv__ = binary(Opcode.DIV)
__rfloordiv__ = rbinary(Opcode.DIV)
__ror__ = __or__ = binary(Opcode.OR)
__lshift__ = binary(Opcode.LSH)
__rlshift__ = rbinary(Opcode.LSH)
......
......@@ -85,8 +85,8 @@ class Tests(TestCase):
e.r4 -= e.r7
e.r4 *= 3
e.r4 *= e.r7
e.r4 /= 3
e.r4 /= e.r7
e.r4 //= 3
e.r4 //= e.r7
e.r4 |= 3
e.r4 |= e.r7
e.r4 &= 3
......@@ -554,7 +554,7 @@ class Tests(TestCase):
def test_reverse_binary(self):
e = EBPF()
e.owners = {0, 1, 2, 3}
e.r3 = 7 / (e.r2 + 2)
e.r3 = 7 // (e.r2 + 2)
e.r3 = 7 << e.r2
e.r3 = 7 % (e.r2 + 3)
e.r3 = 7 >> e.r2
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment