_ReadULEB.c 323 B

1234567891011121314151617181920
  1. #include <libunwind.h>
  2. unw_word_t
  3. _ReadULEB (unsigned char **dpp)
  4. {
  5. unsigned shift = 0;
  6. unw_word_t byte, result = 0;
  7. unsigned char *bp = *dpp;
  8. while (1)
  9. {
  10. byte = *bp++;
  11. result |= (byte & 0x7f) << shift;
  12. if ((byte & 0x80) == 0)
  13. break;
  14. shift += 7;
  15. }
  16. *dpp = bp;
  17. return result;
  18. }