Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  */
0004 
0005 #include <linux/export.h>
0006 
0007 #include <linux/libgcc.h>
0008 
0009 long long notrace __ashrdi3(long long u, word_type b)
0010 {
0011     DWunion uu, w;
0012     word_type bm;
0013 
0014     if (b == 0)
0015         return u;
0016 
0017     uu.ll = u;
0018     bm = 32 - b;
0019 
0020     if (bm <= 0) {
0021         /* w.s.high = 1..1 or 0..0 */
0022         w.s.high =
0023             uu.s.high >> 31;
0024         w.s.low = uu.s.high >> -bm;
0025     } else {
0026         const unsigned int carries = (unsigned int) uu.s.high << bm;
0027 
0028         w.s.high = uu.s.high >> b;
0029         w.s.low = ((unsigned int) uu.s.low >> b) | carries;
0030     }
0031 
0032     return w.ll;
0033 }
0034 EXPORT_SYMBOL(__ashrdi3);