| 616 | } |
| 617 | |
| 618 | uint32_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 | |
| 637 | uint32_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); |
nothing calls this directly
no test coverage detected