aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/lib/lshrdi3.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2010-10-30 22:16:56 +0200
committerJiri Kosina <jkosina@suse.cz>2010-10-30 22:16:56 +0200
commitf1e095f1d206b81b44160f41278ce5c78641e9b7 (patch)
treebd293d46d2d3e4cdf435a22ddb2877c6ba1b8acc /arch/microblaze/lib/lshrdi3.c
parenttelephony: fix return value (diff)
parentMerge branch 'for-linus' of git://git.infradead.org/users/eparis/notify (diff)
downloadlinux-dev-f1e095f1d206b81b44160f41278ce5c78641e9b7.tar.xz
linux-dev-f1e095f1d206b81b44160f41278ce5c78641e9b7.zip
Merge branch 'master' into for-next
Diffstat (limited to 'arch/microblaze/lib/lshrdi3.c')
-rw-r--r--arch/microblaze/lib/lshrdi3.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/microblaze/lib/lshrdi3.c b/arch/microblaze/lib/lshrdi3.c
new file mode 100644
index 000000000000..dcf8d6810b7c
--- /dev/null
+++ b/arch/microblaze/lib/lshrdi3.c
@@ -0,0 +1,29 @@
+#include <linux/module.h>
+
+#include "libgcc.h"
+
+long long __lshrdi3(long long u, word_type b)
+{
+ DWunion uu, w;
+ word_type bm;
+
+ if (b == 0)
+ return u;
+
+ uu.ll = u;
+ bm = 32 - b;
+
+ if (bm <= 0) {
+ w.s.high = 0;
+ w.s.low = (unsigned int) uu.s.high >> -bm;
+ } else {
+ const unsigned int carries = (unsigned int) uu.s.high << bm;
+
+ w.s.high = (unsigned int) uu.s.high >> b;
+ w.s.low = ((unsigned int) uu.s.low >> b) | carries;
+ }
+
+ return w.ll;
+}
+
+EXPORT_SYMBOL(__lshrdi3);