File tree Expand file tree Collapse file tree 2 files changed +13
-11
lines changed
Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change 11/*
22 * CallstackLibrary - Library creating human-readable call stacks.
33 *
4- * Copyright (C) 2024 mhahnFr
4+ * Copyright (C) 2024 - 2025 mhahnFr
55 *
66 * This file is part of the CallstackLibrary.
77 *
@@ -29,7 +29,7 @@ uint64_t getULEB128(const void* begin, size_t* counter) {
2929
3030 bool more = true;
3131 do {
32- uint8_t b = * (( const uint8_t * ) (begin + * counter ) );
32+ const uint8_t b = * (const uint8_t * ) (begin + * counter );
3333 * counter += 1 ;
3434 result |= (b & 0x7f ) << shift ;
3535 shift += 7 ;
@@ -46,13 +46,13 @@ int64_t getLEB128(const void* begin, size_t* counter) {
4646
4747 bool more = true;
4848 do {
49- uint8_t b = * (( const uint8_t * ) (begin + * counter ) );
49+ const uint8_t b = * (const uint8_t * ) (begin + * counter );
5050 * counter += 1 ;
5151 result |= (b & 0x7f ) << shift ;
5252 shift += 7 ;
5353 if ((0x80 & b ) == 0 ) {
5454 if (shift < 32 && (b & 0x40 ) != 0 ) {
55- result |= ((uint64_t ) ~0 << shift );
55+ result |= (int64_t ) ( (uint64_t ) ~0 << shift );
5656 }
5757 more = false;
5858 }
Original file line number Diff line number Diff line change 11/*
22 * CallstackLibrary - Library creating human-readable call stacks.
33 *
4- * Copyright (C) 2024 mhahnFr
4+ * Copyright (C) 2024 - 2025 mhahnFr
55 *
66 * This file is part of the CallstackLibrary.
77 *
2626#include <stdint.h>
2727
2828/**
29- * @brief Reads an unsigned LEB128 integer from the given memory at the given position.
29+ * @brief Reads an unsigned LEB128 integer from the given memory at the given
30+ * position.
3031 *
31- * The given memory position points to the first byte after the read number once this function returns.
32+ * The given memory position points to the first byte after the read number
33+ * once this function returns.
3234 *
3335 * @param begin the memory pointer
3436 * @param counter the memory position
3739uint64_t getULEB128 (const void * begin , size_t * counter );
3840
3941/**
40- * @brief Reads a signed LEB128 integer from the given memory at the given position.
42+ * @brief Reads a signed LEB128 integer from the given memory at the given
43+ * position.
4144 *
42- * The given memory position points to the first byte after the read number once this function returns.
45+ * The given memory position points to the first byte after the read number
46+ * once this function returns.
4347 *
4448 * @param begin the memory pointer
4549 * @param counter the memory position
4650 * @return the deducted number
4751 */
4852int64_t getLEB128 (const void * begin , size_t * counter );
4953
50-
51-
5254#endif /* leb128_h */
You can’t perform that action at this time.
0 commit comments