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

Function libdivide_u64_do

numpy/core/include/numpy/libdivide/libdivide.h:777–794  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

775}
776
777uint64_t libdivide_u64_do(uint64_t numer, const struct libdivide_u64_t *denom) {
778 uint8_t more = denom->more;
779 if (!denom->magic) {
780 return numer >> more;
781 }
782 else {
783 uint64_t q = libdivide_mullhi_u64(denom->magic, numer);
784 if (more & LIBDIVIDE_ADD_MARKER) {
785 uint64_t t = ((numer - q) >> 1) + q;
786 return t >> (more & LIBDIVIDE_64_SHIFT_MASK);
787 }
788 else {
789 // All upper bits are 0,
790 // don't need to mask them off.
791 return q >> more;
792 }
793 }
794}
795
796uint64_t libdivide_u64_branchfree_do(uint64_t numer, const struct libdivide_u64_branchfree_t *denom) {
797 uint64_t q = libdivide_mullhi_u64(denom->magic, numer);

Callers

nothing calls this directly

Calls 1

libdivide_mullhi_u64Function · 0.85

Tested by

no test coverage detected