blob: bb340accba2f56180ad68cfe30e342837b879215 [file] [log] [blame]
Phil Edworthyeeb84df2011-06-02 22:15:27 +00001#include "libgcc.h"
2
3long long __lshrdi3(long long u, word_type b)
4{
5 DWunion uu, w;
6 word_type bm;
7
8 if (b == 0)
9 return u;
10
11 uu.ll = u;
12 bm = 32 - b;
13
14 if (bm <= 0) {
15 w.s.high = 0;
16 w.s.low = (unsigned int) uu.s.high >> -bm;
17 } else {
18 const unsigned int carries = (unsigned int) uu.s.high << bm;
19
20 w.s.high = (unsigned int) uu.s.high >> b;
21 w.s.low = ((unsigned int) uu.s.low >> b) | carries;
22 }
23
24 return w.ll;
25}