diff --git a/pystencils/integer_functions.py b/pystencils/integer_functions.py index 4e583d9ab53469deef93c665c26876ae08364f4a..e06c9d5e8ae2d08c6d32032063d454425b552d1a 100644 --- a/pystencils/integer_functions.py +++ b/pystencils/integer_functions.py @@ -3,13 +3,13 @@ import sympy as sp from pystencils.data_types import collate_types, get_type_of_expression from pystencils.sympyextensions import is_integer_sequence -bitwise_xor = sp.Function("bitwise_xor") -bit_shift_right = sp.Function("bit_shift_right") -bit_shift_left = sp.Function("bit_shift_left") -bitwise_and = sp.Function("bitwise_and") -bitwise_or = sp.Function("bitwise_or") -int_div = sp.Function("int_div") -int_power_of_2 = sp.Function("int_power_of_2") +bitwise_xor = sp.Function("bitwise_xor", integer=True) +bit_shift_right = sp.Function("bit_shift_right", integer=True) +bit_shift_left = sp.Function("bit_shift_left", integer=True) +bitwise_and = sp.Function("bitwise_and", integer=True) +bitwise_or = sp.Function("bitwise_or", integer=True) +int_div = sp.Function("int_div", integer=True) +int_power_of_2 = sp.Function("int_power_of_2", integer=True) # noinspection PyPep8Naming @@ -29,6 +29,7 @@ class modulo_floor(sp.Function): '(int64_t)((a) / (b)) * (b)' """ nargs = 2 + integer = True def __new__(cls, integer, divisor): if is_integer_sequence((integer, divisor)): @@ -60,6 +61,7 @@ class modulo_ceil(sp.Function): '((a) % (b) == 0 ? a : ((int64_t)((a) / (b))+1) * (b))' """ nargs = 2 + integer = True def __new__(cls, integer, divisor): if is_integer_sequence((integer, divisor)): @@ -89,6 +91,7 @@ class div_ceil(sp.Function): '( (a) % (b) == 0 ? (int64_t)(a) / (int64_t)(b) : ( (int64_t)(a) / (int64_t)(b) ) +1 )' """ nargs = 2 + integer = True def __new__(cls, integer, divisor): if is_integer_sequence((integer, divisor)): @@ -118,6 +121,7 @@ class div_floor(sp.Function): '((int64_t)(a) / (int64_t)(b))' """ nargs = 2 + integer = True def __new__(cls, integer, divisor): if is_integer_sequence((integer, divisor)):