utility functions that profit from templates
- begin repeat
- name = int, uint, long, ulong,
- longlong, ulonglong, intp#
- #type = npy_int, npy_uint, npy_long, npy_ulong,
- npy_longlong, npy_ulonglong, npy_intp#
- MAX = NPY_MAX_INT, NPY_MAX_UINT, NPY_MAX_LONG, NPY_MAX_ULONG,
- NPY_MAX_LONGLONG, NPY_MAX_ULONGLONG, NPY_MAX_INTP#
writes result of a * b into r returns 1 if a * b overflowed else returns 0
These functions are not designed to work if either a or b is negative, but that is not checked. Could use absolute values and adjust the sign if that functionality was desired.
avoid expensive division on common no overflow case