Commit da54b3ec authored by Nils Kohl's avatar Nils Kohl 🌝
Browse files

Added integer function that does a post increment

parent 13e4eba9
...@@ -13,7 +13,7 @@ except ImportError: ...@@ -13,7 +13,7 @@ except ImportError:
from sympy.printing.ccode import CCodePrinter # for sympy versions < 1.1 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, \ 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.astnodes import Node, KernelFunction
from pystencils.data_types import create_type, PointerType, get_type_of_expression, VectorType, cast_func, \ from pystencils.data_types import create_type, PointerType, get_type_of_expression, VectorType, cast_func, \
vector_memory_access, reinterpret_cast_func vector_memory_access, reinterpret_cast_func
...@@ -311,6 +311,8 @@ class CustomSympyPrinter(CCodePrinter): ...@@ -311,6 +311,8 @@ class CustomSympyPrinter(CCodePrinter):
return "((%s) / (%s))" % (self._print(expr.args[0]), self._print(expr.args[1])) return "((%s) / (%s))" % (self._print(expr.args[0]), self._print(expr.args[1]))
elif expr.func == int_mod: elif expr.func == int_mod:
return "((%s) %% (%s))" % (self._print(expr.args[0]), self._print(expr.args[1])) 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: else:
return super(CustomSympyPrinter, self)._print_Function(expr) return super(CustomSympyPrinter, self)._print_Function(expr)
......
...@@ -11,6 +11,7 @@ bitwise_or = sp.Function("bitwise_or") ...@@ -11,6 +11,7 @@ bitwise_or = sp.Function("bitwise_or")
int_div = sp.Function("int_div") int_div = sp.Function("int_div")
int_power_of_2 = sp.Function("int_power_of_2") int_power_of_2 = sp.Function("int_power_of_2")
int_mod = sp.Function("int_mod") int_mod = sp.Function("int_mod")
inc_post = sp.Function("inc_post")
# noinspection PyPep8Naming # noinspection PyPep8Naming
......
Markdown is supported
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