lshrdi3.c 423 B

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