Merge tag 'locks-v3.16-2' of git://git.samba.org/jlayton/linux
[linux/fpc-iii.git] / arch / sh / lib / ashrdi3.c
blobc884a912b660ea28c88abe9d923d2a7214ccadcd
1 #include <linux/module.h>
3 #include "libgcc.h"
5 long long __ashrdi3(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 = 1..1 or 0..0 */
18 w.s.high =
19 uu.s.high >> 31;
20 w.s.low = uu.s.high >> -bm;
21 } else {
22 const unsigned int carries = (unsigned int) uu.s.high << bm;
24 w.s.high = uu.s.high >> b;
25 w.s.low = ((unsigned int) uu.s.low >> b) | carries;
28 return w.ll;
31 EXPORT_SYMBOL(__ashrdi3);