Annotation of qemu/roms/openbios/libgcc/ashrdi3.c, revision 1.1.1.1

1.1       root        1: /* ashrdi3.c extracted from gcc-2.7.2/libgcc2.c which is: */
                      2: /* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
                      3: 
                      4: This file is part of GNU CC.
                      5: 
                      6: GNU CC is free software; you can redistribute it and/or modify
                      7: it under the terms of the GNU General Public License as published by
                      8: the Free Software Foundation; either version 2, or (at your option)
                      9: any later version.
                     10: 
                     11: GNU CC is distributed in the hope that it will be useful,
                     12: but WITHOUT ANY WARRANTY; without even the implied warranty of
                     13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     14: GNU General Public License for more details.
                     15: 
                     16: You should have received a copy of the GNU General Public License
                     17: along with GNU CC; see the file COPYING.  If not, write to
                     18: the Free Software Foundation, 51 Franklin St, Fifth Floor, Boston,
                     19: MA 02110-1301, USA. */
                     20: 
                     21: #include "libgcc.h"
                     22: 
                     23: #define BITS_PER_UNIT 8
                     24: 
                     25: struct DIstruct {SItype high, low;};
                     26: 
                     27: typedef union
                     28: {
                     29:   struct DIstruct s;
                     30:   DItype ll;
                     31: } DIunion;
                     32: 
                     33: DItype
                     34: __ashrdi3 (DItype u, word_type b)
                     35: {
                     36:   DIunion w;
                     37:   word_type bm;
                     38:   DIunion uu;
                     39: 
                     40:   if (b == 0)
                     41:     return u;
                     42: 
                     43:   uu.ll = u;
                     44: 
                     45:   bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
                     46:   if (bm <= 0)
                     47:     {
                     48:       /* w.s.high = 1..1 or 0..0 */
                     49:       w.s.high = uu.s.high >> (sizeof (SItype) * BITS_PER_UNIT - 1);
                     50:       w.s.low = uu.s.high >> -bm;
                     51:     }
                     52:   else
                     53:     {
                     54:       USItype carries = (USItype)uu.s.high << bm;
                     55:       w.s.high = uu.s.high >> b;
                     56:       w.s.low = ((USItype)uu.s.low >> b) | carries;
                     57:     }
                     58: 
                     59:   return w.ll;
                     60: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.