summaryrefslogtreecommitdiffstats
path: root/usr/klibc/libgcc/__ashldi3.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/libgcc/__ashldi3.c')
-rw-r--r--usr/klibc/libgcc/__ashldi3.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/usr/klibc/libgcc/__ashldi3.c b/usr/klibc/libgcc/__ashldi3.c
new file mode 100644
index 0000000..95937f0
--- /dev/null
+++ b/usr/klibc/libgcc/__ashldi3.c
@@ -0,0 +1,23 @@
+/*
+ * libgcc/__ashldi3.c
+ */
+
+#include <stdint.h>
+#include <stddef.h>
+
+uint64_t __ashldi3(uint64_t v, int cnt)
+{
+ int c = cnt & 31;
+ uint32_t vl = (uint32_t) v;
+ uint32_t vh = (uint32_t) (v >> 32);
+
+ if (cnt & 32) {
+ vh = (vl << c);
+ vl = 0;
+ } else {
+ vh = (vh << c) + (vl >> (32 - c));
+ vl = (vl << c);
+ }
+
+ return ((uint64_t) vh << 32) + vl;
+}