summaryrefslogtreecommitdiff
path: root/src/third_party/unwind/dist/src/mi/_ReadULEB.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/third_party/unwind/dist/src/mi/_ReadULEB.c')
-rw-r--r--src/third_party/unwind/dist/src/mi/_ReadULEB.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/third_party/unwind/dist/src/mi/_ReadULEB.c b/src/third_party/unwind/dist/src/mi/_ReadULEB.c
new file mode 100644
index 00000000000..116f3e19bc9
--- /dev/null
+++ b/src/third_party/unwind/dist/src/mi/_ReadULEB.c
@@ -0,0 +1,20 @@
+#include <libunwind.h>
+
+unw_word_t
+_ReadULEB (unsigned char **dpp)
+{
+ unsigned shift = 0;
+ unw_word_t byte, result = 0;
+ unsigned char *bp = *dpp;
+
+ while (1)
+ {
+ byte = *bp++;
+ result |= (byte & 0x7f) << shift;
+ if ((byte & 0x80) == 0)
+ break;
+ shift += 7;
+ }
+ *dpp = bp;
+ return result;
+}