From e6546bb938f5326269b6669d6cbb44d72458caa4 Mon Sep 17 00:00:00 2001 From: Orit Wasserman Date: Mon, 6 Aug 2012 21:42:51 +0300 Subject: Add uleb encoding/decoding functions Implement Unsigned Little Endian Base 128. Signed-off-by: Orit Wasserman Reviewed-by: Luiz Capitulino Reviewed-by: Eric Blake --- qemu-common.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'qemu-common.h') diff --git a/qemu-common.h b/qemu-common.h index ff7026e..9c1b955 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -443,4 +443,12 @@ int64_t pow2floor(int64_t value); #include "module.h" +/* + * Implementation of ULEB128 (http://en.wikipedia.org/wiki/LEB128) + * Input is limited to 14-bit numbers + */ + +int uleb128_encode_small(uint8_t *out, uint32_t n); +int uleb128_decode_small(const uint8_t *in, uint32_t *n); + #endif -- cgit v1.1