linux/arch/h8300/lib/lshrdi3.c
<<
>>
Prefs
   1#include "libgcc.h"
   2
   3DWtype __lshrdi3(DWtype u, word_type b)
   4{
   5        const DWunion uu = {.ll = u};
   6        const word_type bm = (sizeof (Wtype) * BITS_PER_UNIT) - b;
   7        DWunion w;
   8
   9        if (b == 0)
  10                return u;
  11
  12        if (bm <= 0) {
  13                w.s.high = 0;
  14                w.s.low = (UWtype) uu.s.high >> -bm;
  15        } else {
  16                const UWtype carries = (UWtype) uu.s.high << bm;
  17
  18                w.s.high = (UWtype) uu.s.high >> b;
  19                w.s.low = ((UWtype) uu.s.low >> b) | carries;
  20        }
  21
  22        return w.ll;
  23}
  24