/* lshrdi3.c extracted from gcc-2.7.2/libgcc2.c which is: */1/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.23This file is part of GNU CC.45GNU CC is free software; you can redistribute it and/or modify6it under the terms of the GNU General Public Licence as published by7the Free Software Foundation; either version 2, or (at your option)8any later version.910GNU CC is distributed in the hope that it will be useful,11but WITHOUT ANY WARRANTY; without even the implied warranty of12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13GNU General Public Licence for more details.1415You should have received a copy of the GNU General Public Licence16along with GNU CC; see the file COPYING. If not, write to17the Free Software Foundation, 59 Temple Place - Suite 330,18Boston, MA 02111-1307, USA. */1920#define BITS_PER_UNIT 82122typedef int SItype __attribute__((mode(SI)));23typedef unsigned int USItype __attribute__((mode(SI)));24typedef int DItype __attribute__((mode(DI)));25typedef int word_type __attribute__((mode(__word__)));2627struct DIstruct {28SItype low;29SItype high;30};3132union DIunion {33struct DIstruct s;34DItype ll;35};3637DItype __lshrdi3(DItype u, word_type b)38{39union DIunion w;40word_type bm;41union DIunion uu;4243if (b == 0)44return u;4546uu.ll = u;4748bm = (sizeof(SItype) * BITS_PER_UNIT) - b;49if (bm <= 0) {50w.s.high = 0;51w.s.low = (USItype) uu.s.high >> -bm;52} else {53USItype carries = (USItype) uu.s.high << bm;54w.s.high = (USItype) uu.s.high >> b;55w.s.low = ((USItype) uu.s.low >> b) | carries;56}5758return w.ll;59}606162