MCPcopy Create free account
hub / github.com/numpy/numpy / libdivide_u32_do

Function libdivide_u32_do

numpy/core/include/numpy/libdivide/libdivide.h:618–635  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

616}
617
618uint32_t libdivide_u32_do(uint32_t numer, const struct libdivide_u32_t *denom) {
619 uint8_t more = denom->more;
620 if (!denom->magic) {
621 return numer >> more;
622 }
623 else {
624 uint32_t q = libdivide_mullhi_u32(denom->magic, numer);
625 if (more & LIBDIVIDE_ADD_MARKER) {
626 uint32_t t = ((numer - q) >> 1) + q;
627 return t >> (more & LIBDIVIDE_32_SHIFT_MASK);
628 }
629 else {
630 // All upper bits are 0,
631 // don't need to mask them off.
632 return q >> more;
633 }
634 }
635}
636
637uint32_t libdivide_u32_branchfree_do(uint32_t numer, const struct libdivide_u32_branchfree_t *denom) {
638 uint32_t q = libdivide_mullhi_u32(denom->magic, numer);

Callers

nothing calls this directly

Calls 1

libdivide_mullhi_u32Function · 0.85

Tested by

no test coverage detected