ashldi3.c 619 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright 2004-2009 Analog Devices Inc.
  3. *
  4. * Licensed under the GPL-2 or later.
  5. */
  6. #include "gcclib.h"
  7. #ifdef CONFIG_ARITHMETIC_OPS_L1
  8. DItype __ashldi3(DItype u, word_type b)__attribute__((l1_text));
  9. #endif
  10. DItype __ashldi3(DItype u, word_type b)
  11. {
  12. DIunion w;
  13. word_type bm;
  14. DIunion uu;
  15. if (b == 0)
  16. return u;
  17. uu.ll = u;
  18. bm = (sizeof(SItype) * BITS_PER_UNIT) - b;
  19. if (bm <= 0) {
  20. w.s.low = 0;
  21. w.s.high = (USItype) uu.s.low << -bm;
  22. } else {
  23. USItype carries = (USItype) uu.s.low >> bm;
  24. w.s.low = (USItype) uu.s.low << b;
  25. w.s.high = ((USItype) uu.s.high << b) | carries;
  26. }
  27. return w.ll;
  28. }