/*1* arch/score/lib/lshrdi3.c2*3* This program is free software; you can redistribute it and/or modify4* it under the terms of the GNU General Public License as published by5* the Free Software Foundation; either version 2 of the License, or6* (at your option) any later version.7*8* This program is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11* GNU General Public License for more details.12*13* You should have received a copy of the GNU General Public License14* along with this program; if not, see the file COPYING, or write15* to the Free Software Foundation, Inc.,16* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA17*/181920#include <linux/module.h>21#include "libgcc.h"2223long long __lshrdi3(long long u, word_type b)24{25DWunion uu, w;26word_type bm;2728if (b == 0)29return u;3031uu.ll = u;32bm = 32 - b;3334if (bm <= 0) {35w.s.high = 0;36w.s.low = (unsigned int) uu.s.high >> -bm;37} else {38const unsigned int carries = (unsigned int) uu.s.high << bm;3940w.s.high = (unsigned int) uu.s.high >> b;41w.s.low = ((unsigned int) uu.s.low >> b) | carries;42}4344return w.ll;45}46EXPORT_SYMBOL(__lshrdi3);474849