aboutsummaryrefslogtreecommitdiff
path: root/arch/score/lib/lshrdi3.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-18 09:45:08 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-18 09:45:08 -0700
commit81ce31b773226332475f89501b1072bec0c0e241 (patch)
treecd66f3c1caf731cc552ae90af2068aecabaed334 /arch/score/lib/lshrdi3.c
parent515b696b282f856c3ad1679ccd658120faa387d0 (diff)
parent9973affe9bbcde64041890d8793eb2e74143c298 (diff)
Merge branch 'for-linus' of git://gitserver.sunplusct.com/linux-2.6-score
* 'for-linus' of git://gitserver.sunplusct.com/linux-2.6-score: (22 commits) score: add TIF_NOTIFY_RESUME define in asm/thread_info.h score: make init_thread_union align to THREAD_SIZE score: update files according to review comments. score: add old syscall support score: add MEMORY_START and MEMORY_SIZE define, to make the code clear score: update inconsistent declare after .c was changed score: remove unused code, add include files in .c score: clean up mm/init.c score: make irq.h definitions local score: cleanups: dead code, 0 as pointer, shadowed variables score: fix function prototypes score: add address space annotations score: add missing #includes score: move save arg5 and arg6 instruction in front of enable_irq score: add prototypes for wrapped syscalls score: remove init_mm score: add generic sys_call_table score: remove __{put,get}_user_unknown score: unset __ARCH_WANT_IPC_PARSE_VERSION score: update files according to review comments ...
Diffstat (limited to 'arch/score/lib/lshrdi3.c')
-rw-r--r--arch/score/lib/lshrdi3.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/arch/score/lib/lshrdi3.c b/arch/score/lib/lshrdi3.c
new file mode 100644
index 00000000000..ce21175fd79
--- /dev/null
+++ b/arch/score/lib/lshrdi3.c
@@ -0,0 +1,47 @@
+/*
+ * arch/score/lib/lshrdi3.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see the file COPYING, or write
+ * to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#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);