Imported Upstream version 1.1
[platform/upstream/libunwind.git] / src / mi / _ReadULEB.c
1 #include <libunwind.h>
2
3 unw_word_t
4 _ReadULEB (unsigned char **dpp)
5 {
6   unsigned shift = 0;
7   unw_word_t byte, result = 0;
8   unsigned char *bp = *dpp;
9
10   while (1)
11     {
12       byte = *bp++;
13       result |= (byte & 0x7f) << shift;
14       if ((byte & 0x80) == 0)
15         break;
16       shift += 7;
17     }
18   *dpp = bp;
19   return result;
20 }