Skip to content
Snippets Groups Projects
Commit da54b3ec authored by Nils Kohl's avatar Nils Kohl :full_moon_with_face:
Browse files

Added integer function that does a post increment

parent 13e4eba9
Branches hyteg
No related merge requests found
......@@ -13,7 +13,7 @@ except ImportError:
from sympy.printing.ccode import CCodePrinter # for sympy versions < 1.1
from pystencils.integer_functions import bitwise_xor, bit_shift_right, bit_shift_left, bitwise_and, \
bitwise_or, modulo_ceil, int_div, int_power_of_2, int_mod
bitwise_or, modulo_ceil, int_div, int_power_of_2, int_mod, inc_post
from pystencils.astnodes import Node, KernelFunction
from pystencils.data_types import create_type, PointerType, get_type_of_expression, VectorType, cast_func, \
vector_memory_access, reinterpret_cast_func
......@@ -311,6 +311,8 @@ class CustomSympyPrinter(CCodePrinter):
return "((%s) / (%s))" % (self._print(expr.args[0]), self._print(expr.args[1]))
elif expr.func == int_mod:
return "((%s) %% (%s))" % (self._print(expr.args[0]), self._print(expr.args[1]))
elif expr.func == inc_post:
return "(%s++)" % (self._print(expr.args[0]))
else:
return super(CustomSympyPrinter, self)._print_Function(expr)
......
......@@ -11,6 +11,7 @@ bitwise_or = sp.Function("bitwise_or")
int_div = sp.Function("int_div")
int_power_of_2 = sp.Function("int_power_of_2")
int_mod = sp.Function("int_mod")
inc_post = sp.Function("inc_post")
# noinspection PyPep8Naming
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment