div64-generic.c 283 B

1234567891011121314151617181920
  1. /*
  2. * Generic __div64_32 wrapper for __xdiv64_32.
  3. */
  4. #include <linux/types.h>
  5. #include <asm/div64.h>
  6. extern uint64_t __xdiv64_32(u64 n, u32 d);
  7. uint32_t __div64_32(u64 *xp, u32 y)
  8. {
  9. uint32_t rem;
  10. uint64_t q = __xdiv64_32(*xp, y);
  11. rem = *xp - q * y;
  12. *xp = q;
  13. return rem;
  14. }