These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / arch / h8300 / lib / lshrdi3.c
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 }