ashrdi3.c 507 B

1234567891011121314151617181920212223242526272829303132
  1. #include <linux/export.h>
  2. #include "libgcc.h"
  3. long long notrace __ashrdi3(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 = 1..1 or 0..0 */
  13. w.s.high =
  14. uu.s.high >> 31;
  15. w.s.low = uu.s.high >> -bm;
  16. } else {
  17. const unsigned int carries = (unsigned int) uu.s.high << bm;
  18. w.s.high = uu.s.high >> b;
  19. w.s.low = ((unsigned int) uu.s.low >> b) | carries;
  20. }
  21. return w.ll;
  22. }
  23. EXPORT_SYMBOL(__ashrdi3);