| 775 | } |
| 776 | |
| 777 | uint64_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 | |
| 796 | uint64_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); |
nothing calls this directly
no test coverage detected