ashldi3.c 430 B

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