386BSD 0.1 development
authorWilliam F. Jolitz <wjolitz@soda.berkeley.edu>
Tue, 22 Jan 1991 06:50:17 +0000 (22:50 -0800)
committerWilliam F. Jolitz <wjolitz@soda.berkeley.edu>
Tue, 22 Jan 1991 06:50:17 +0000 (22:50 -0800)
Work on file usr/src/usr.bin/gcc/gnulib/longlong/ashrdi3.c

Co-Authored-By: Lynne Greer Jolitz <ljolitz@cardio.ucsf.edu>
Synthesized-from: 386BSD-0.1

usr/src/usr.bin/gcc/gnulib/longlong/ashrdi3.c [new file with mode: 0644]

diff --git a/usr/src/usr.bin/gcc/gnulib/longlong/ashrdi3.c b/usr/src/usr.bin/gcc/gnulib/longlong/ashrdi3.c
new file mode 100644 (file)
index 0000000..fd192bf
--- /dev/null
@@ -0,0 +1,33 @@
+#include "longlong.h"
+
+long long
+__ashrdi3 (u, b1)
+     long long u;
+     long long b1;
+{
+  long_long w;
+  unsigned long carries;
+  int bm;
+  long_long uu;
+  int b = b1;
+
+  if (b == 0)
+    return u;
+
+  uu.ll = u;
+
+  bm = (sizeof (int) * BITS_PER_UNIT) - b;
+  if (bm <= 0)
+    {
+      w.s.high = uu.s.high >> 31; /* just to make w.s.high 1..1 or 0..0 */
+      w.s.low = uu.s.high >> -bm;
+    }
+  else
+    {
+      carries = (unsigned long)uu.s.high << bm;
+      w.s.high = uu.s.high >> b;
+      w.s.low = ((unsigned long)uu.s.low >> b) | carries;
+    }
+
+  return w.ll;
+}