diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-08-18 08:06:20 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-08-18 17:18:04 +0900 |
| commit | 20635e6bdc2899d649c2f3fe12f4e82739ee2a54 (patch) | |
| tree | cb280996f1b7f9c117290239f444b28f594795a9 /mrbgems/mruby-bin-debugger | |
| parent | 96a8703ca8edf78b685808feb33730c587172e4d (diff) | |
| download | mruby-20635e6bdc2899d649c2f3fe12f4e82739ee2a54.tar.gz mruby-20635e6bdc2899d649c2f3fe12f4e82739ee2a54.zip | |
debug.c: export integer compressing functions.
- mrb_packed_int_len()
- mrb_packed_int_encode()
- mrb_packed_int_decode()
Diffstat (limited to 'mrbgems/mruby-bin-debugger')
| -rw-r--r-- | mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c b/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c index a26630599..66cc9ad94 100644 --- a/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c +++ b/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c @@ -20,20 +20,7 @@ #define MRB_DEBUG_BP_FILE_OK (0x0001) #define MRB_DEBUG_BP_LINENO_OK (0x0002) -static uint32_t -packed_int_decode(uint8_t *p, uint8_t **newpos) -{ - size_t i = 0, shift = 0; - uint32_t n = 0; - - do { - n |= ((uint32_t)(p[i] & 0x7f)) << shift; - i++; - shift += 7; - } while (shift < sizeof(uint32_t) * 8 && (p[i - 1] & 0x80)); - if (newpos) *newpos = p + i; - return n; -} +uint32_t mrb_packed_int_decode(uint8_t *p, uint8_t **newpos); static uint16_t check_lineno(mrb_irep_debug_info_file *info_file, uint16_t lineno) @@ -64,8 +51,8 @@ check_lineno(mrb_irep_debug_info_file *info_file, uint16_t lineno) uint8_t *pend = p + count; uint32_t line = 0; while (p < pend) { - packed_int_decode(p, &p); - line += packed_int_decode(p, &p); + mrb_packed_int_decode(p, &p); + line += mrb_packed_int_decode(p, &p); if (line == lineno) return lineno; } } |
