lshrdi3.c 477 B

123456789101112131415161718192021222324252627282930
  1. #include <linux/module.h>
  2. #include "libgcc.h"
  3. long long __lshrdi3(long long u, word_type b)
  4. {
  5. DWunion uu, w;
  6. word_type bm;
  7. if (b == 0)
  8. return u;
  9. uu.ll = u;
  10. bm = 32 - b;
  11. if (bm <= 0) {
  12. w.s.high = 0;
  13. w.s.low = (unsigned int) uu.s.high >> -bm;
  14. } else {
  15. const unsigned int carries = (unsigned int) uu.s.high << bm;
  16. w.s.high = (unsigned int) uu.s.high >> b;
  17. w.s.low = ((unsigned int) uu.s.low >> b) | carries;
  18. }
  19. return w.ll;
  20. }
  21. EXPORT_SYMBOL(__lshrdi3);