ashldi3.c 541 B

1234567891011121314151617181920212223242526272829303132
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. */
  4. #include <linux/export.h>
  5. #include <linux/libgcc.h>
  6. long long notrace __ashldi3(long long u, word_type b)
  7. {
  8. DWunion uu, w;
  9. word_type bm;
  10. if (b == 0)
  11. return u;
  12. uu.ll = u;
  13. bm = 32 - b;
  14. if (bm <= 0) {
  15. w.s.low = 0;
  16. w.s.high = (unsigned int) uu.s.low << -bm;
  17. } else {
  18. const unsigned int carries = (unsigned int) uu.s.low >> bm;
  19. w.s.low = (unsigned int) uu.s.low << b;
  20. w.s.high = ((unsigned int) uu.s.high << b) | carries;
  21. }
  22. return w.ll;
  23. }
  24. EXPORT_SYMBOL(__ashldi3);