Skip to content
Snippets Groups Projects

WIP: Hyteg

Closed Dominik Thoennes requested to merge hyteg into master
2 files
+ 4
1
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -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
bitwise_or, modulo_ceil, int_div, int_power_of_2, int_mod
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
@@ -308,6 +308,8 @@ class CustomSympyPrinter(CCodePrinter):
@@ -308,6 +308,8 @@ class CustomSympyPrinter(CCodePrinter):
return "(1 << (%s))" % (self._print(expr.args[0]))
return "(1 << (%s))" % (self._print(expr.args[0]))
elif expr.func == int_div:
elif expr.func == int_div:
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:
 
return "((%s) %% (%s))" % (self._print(expr.args[0]), self._print(expr.args[1]))
else:
else:
return super(CustomSympyPrinter, self)._print_Function(expr)
return super(CustomSympyPrinter, self)._print_Function(expr)
Loading