[Cython] question on Get/SetItemInt*() utility functions

2013-11-08 Thread Stefan Behnel
Hi, the Get/SetItemInt helper macros usually look something like this: """ #define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \ __Pyx_GetItemInt_Generi

Re: [Cython] question on Get/SetItemInt*() utility functions

2013-11-08 Thread Stefan Behnel
Having thought about this come more: Stefan Behnel, 08.11.2013 15:16: > the Get/SetItemInt helper macros usually look something like this: > > """ > #define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, > boundscheck) \ > (((size) <= sizeof(Py_ssize_t)) ? \ I noticed that the

Re: [Cython] question on Get/SetItemInt*() utility functions

2013-11-08 Thread Stefan Behnel
Stefan Behnel, 09.11.2013 07:17: > Putting it all together, we can use the fast path in these cases: > > (sizeof(type_of_i) < sizeof(Py_ssize_t)) || > > (sizeof(type_of_i) > sizeof(Py_ssize_t) && > (i <= (type_of_i)PY_SSIZE_T_MAX) && > (!signed || i >= (type_of_i)PY_