reduce amount of casts in helper code
reduce amount of casts in helper code

cython/cython,cython/cython,cython/cython,da-woods/cython,scoder/cython,scoder/cython,scoder/cython,da-woods/cython,da-woods/cython,da-woods/cython,cython/cython,scoder/cython