Linux 3.16-rc2
[linux/fpc-iii.git] / arch / microblaze / lib / lshrdi3.c
blobadcb253f11c81f540dd93ca65b49ce84100fb5bb
1 #include <linux/export.h>
3 #include "libgcc.h"
5 long long __lshrdi3(long long u, word_type b)
7 DWunion uu, w;
8 word_type bm;
10 if (b == 0)
11 return u;
13 uu.ll = u;
14 bm = 32 - b;
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;
22 w.s.high = (unsigned int) uu.s.high >> b;
23 w.s.low = ((unsigned int) uu.s.low >> b) | carries;
26 return w.ll;
28 EXPORT_SYMBOL(__lshrdi3);