Michal Simek | d64af91 | 2013-02-01 13:10:35 +0100 | [diff] [blame] | 1 | #include <linux/export.h> |
Michal Simek | 4e07dba | 2010-08-12 14:28:53 +0200 | [diff] [blame] | 2 | |
| 3 | #include "libgcc.h" |
| 4 | |
| 5 | long long __lshrdi3(long long u, word_type b) |
| 6 | { |
| 7 | DWunion uu, w; |
| 8 | word_type bm; |
| 9 | |
| 10 | if (b == 0) |
| 11 | return u; |
| 12 | |
| 13 | uu.ll = u; |
| 14 | bm = 32 - b; |
| 15 | |
| 16 | if (bm <= 0) { |
| 17 | w.s.high = 0; |
| 18 | w.s.low = (unsigned int) uu.s.high >> -bm; |
| 19 | } else { |
| 20 | const unsigned int carries = (unsigned int) uu.s.high << bm; |
| 21 | |
| 22 | w.s.high = (unsigned int) uu.s.high >> b; |
| 23 | w.s.low = ((unsigned int) uu.s.low >> b) | carries; |
| 24 | } |
| 25 | |
| 26 | return w.ll; |
| 27 | } |
Michal Simek | 4e07dba | 2010-08-12 14:28:53 +0200 | [diff] [blame] | 28 | EXPORT_SYMBOL(__lshrdi3); |