/* 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 License 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 License for more details.1415You should have received a copy of the GNU General Public License16along 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 {SItype high, low;};2829typedef union30{31struct DIstruct s;32DItype ll;33} DIunion;3435DItype36__lshrdi3 (DItype u, word_type b)37{38DIunion w;39word_type bm;40DIunion uu;4142if (b == 0)43return u;4445uu.ll = u;4647bm = (sizeof (SItype) * BITS_PER_UNIT) - b;48if (bm <= 0)49{50w.s.high = 0;51w.s.low = (USItype)uu.s.high >> -bm;52}53else54{55USItype carries = (USItype)uu.s.high << bm;56w.s.high = (USItype)uu.s.high >> b;57w.s.low = ((USItype)uu.s.low >> b) | carries;58}5960return w.ll;61}626364