ashldi3.c 475 B

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