summaryrefslogtreecommitdiff
path: root/src/common/leb128.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/leb128.h')
-rw-r--r--src/common/leb128.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/common/leb128.h b/src/common/leb128.h
index 2093ead..ae1078a 100644
--- a/src/common/leb128.h
+++ b/src/common/leb128.h
@@ -29,6 +29,7 @@
#include <stdlib.h>
+#include "packed.h"
#include "../arch/archbase.h"
#include "../arch/vmpa.h"
@@ -39,10 +40,12 @@ typedef uint64_t uleb128_t;
typedef int64_t leb128_t;
+/* Quantité de bits utilisés */
+#define LEB128_BITS_COUNT (sizeof(leb128_t) * 8)
+
/* Récupération de la valeur absolue */
#define leb128_abs(v) llabs(v)
-
/* Valeurs minimales et maximales */
#define ULEB128_MIN UINT64_MIN
#define ULEB128_MAX UINT64_MAX
@@ -56,6 +59,17 @@ bool read_uleb128(uleb128_t *, const bin_t *, phys_t *, phys_t);
/* Lit un nombre signé encodé au format LEB128. */
bool read_leb128(leb128_t *, const bin_t *, phys_t *, phys_t);
+/* Encode un nombre non signé encodé au format LEB128. */
+bool pack_uleb128(const uleb128_t *, packed_buffer_t *);
+
+/* Encode un nombre signé encodé au format LEB128. */
+bool pack_leb128(const leb128_t *, packed_buffer_t *);
+
+/* Décode un nombre non signé encodé au format LEB128. */
+bool unpack_uleb128(uleb128_t *, packed_buffer_t *);
+
+/* Décode un nombre signé encodé au format LEB128. */
+bool unpack_leb128(leb128_t *, packed_buffer_t *);
#endif /* _COMMON_LEB128_H */