lshrdi3.c 432 B

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