Yoshinori Sato | a71a29d | 2015-01-28 02:48:15 +0900 | [diff] [blame] | 1 | #include "libgcc.h" |
2 | |||||
3 | DWtype __lshrdi3(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 | |||||
9 | if (b == 0) | ||||
10 | return u; | ||||
11 | |||||
12 | if (bm <= 0) { | ||||
13 | w.s.high = 0; | ||||
14 | w.s.low = (UWtype) uu.s.high >> -bm; | ||||
15 | } else { | ||||
16 | const UWtype carries = (UWtype) uu.s.high << bm; | ||||
17 | |||||
18 | w.s.high = (UWtype) uu.s.high >> b; | ||||
19 | w.s.low = ((UWtype) uu.s.low >> b) | carries; | ||||
20 | } | ||||
21 | |||||
22 | return w.ll; | ||||
23 | } |