@@ -6,7 +6,7 @@ cdef int size_in_bits = sizeof(INT) * 8
66cdef bint is_signed_ = ((< INT> - 1 ) < 0 )
77cdef INT max_value_ = < INT> (two ** (size_in_bits - is_signed_) - 1 )
88cdef INT min_value_ = ~ max_value_
9- cdef INT half_ = max_value_ // 2
9+ cdef INT half_ = max_value_ // < INT > 2
1010
1111# Python visible.
1212is_signed = is_signed_
@@ -19,7 +19,7 @@ import operator
1919from libc.math cimport sqrt
2020
2121cpdef check(func, op, a, b):
22- cdef INT res, op_res
22+ cdef INT res = 0 , op_res = 0
2323 cdef bint func_overflow = False
2424 cdef bint assign_overflow = False
2525 try :
@@ -34,7 +34,7 @@ cpdef check(func, op, a, b):
3434 if not func_overflow:
3535 assert res == op_res, " Inconsistant values: %s (%s , %s ) == %s != %s " % (func, a, b, res, op_res)
3636
37- medium_values = (max_value_ / 2 , max_value_ / 3 , min_value_ / 2 , < INT> sqrt(max_value_) - 1 , < INT> sqrt(max_value_) + 1 )
37+ medium_values = (max_value_ / 2 , max_value_ / 3 , min_value_ / 2 , < INT> sqrt(max_value_) - < INT > 1 , < INT> sqrt(max_value_) + 1 )
3838def run_test (func , op ):
3939 cdef INT offset, b
4040 check(func, op, 300 , 200 )
@@ -44,8 +44,8 @@ def run_test(func, op):
4444 check(func, op, min_value_, min_value_)
4545
4646 for offset in range (5 ):
47- check(func, op, max_value_ - 1 , offset)
48- check(func, op, min_value_ + 1 , offset)
47+ check(func, op, max_value_ - < INT > 1 , offset)
48+ check(func, op, min_value_ + < INT > 1 , offset)
4949 if is_signed_:
5050 check(func, op, max_value_ - 1 , 2 - offset)
5151 check(func, op, min_value_ + 1 , 2 - offset)
0 commit comments