Skip to content
Snippets Groups Projects
Commit b7a64234 authored by Frederik Hennig's avatar Frederik Hennig
Browse files

Symboloc C-style integer remainder

parent 48bcd760
No related branches found
No related tags found
1 merge request!394Extend symbolic language support
......@@ -33,6 +33,7 @@ from ..ast.expressions import (
PsCast,
PsConstantExpr,
PsIntDiv,
PsRem,
PsLeftShift,
PsLookup,
PsRightShift,
......@@ -391,6 +392,8 @@ class FreezeExpressions:
return PsCall(PsMathFunction(MathFunctions.ATan2), args)
case integer_functions.int_div():
return PsIntDiv(*args)
case integer_functions.int_rem():
return PsRem(*args)
case integer_functions.bit_shift_left():
return PsLeftShift(*args)
case integer_functions.bit_shift_right():
......
......@@ -45,9 +45,18 @@ class bitwise_or(IntegerFunctionTwoArgsMixIn):
# noinspection PyPep8Naming
class int_div(IntegerFunctionTwoArgsMixIn):
"""C-style integer division,"""
def _eval_op(self, arg1, arg2):
return int(arg1 // arg2)
return int(arg1 / arg2)
class int_rem(IntegerFunctionTwoArgsMixIn):
"""C-style integer remainder"""
def _eval_op(self, arg1, arg2):
div = int(arg1 / arg2)
return arg1 - div * arg2
# noinspection PyPep8Naming
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment