diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2012-08-13 16:02:11 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-08-13 16:02:11 -0500 |
commit | ac839ccd8c30fe5706cc43f00e056049d6e55377 (patch) | |
tree | d2e37ee8bd7750ce1dd01c4dd6cec21a87551682 /qemu-common.h | |
parent | 6a1f9d0c1fbf186d3d68cb2af43d047637c93072 (diff) | |
parent | dd051c7217eae04191169ac62f6ffb7531c8da32 (diff) |
Merge remote-tracking branch 'quintela/migration-next-20120808' into staging
* quintela/migration-next-20120808:
Restart optimization on stage3 update version
Add XBZRLE statistics
Add migration accounting for normal and duplicate pages
Change total_time to total-time in MigrationStats
Add migrate_set_cache_size command
Add XBZRLE to ram_save_block and ram_save_live
Add xbzrle_encode_buffer and xbzrle_decode_buffer functions
Add uleb encoding/decoding functions
Add cache handling functions
Add XBZRLE documentation
Add migrate-set-capabilities
Add migration capabilities
Diffstat (limited to 'qemu-common.h')
-rw-r--r-- | qemu-common.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/qemu-common.h b/qemu-common.h index f9deca6f86..095e28d89a 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -1,3 +1,4 @@ + /* Common header file that is included by all of qemu. */ #ifndef QEMU_COMMON_H #define QEMU_COMMON_H @@ -429,6 +430,26 @@ static inline uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c) /* Round number up to multiple */ #define QEMU_ALIGN_UP(n, m) QEMU_ALIGN_DOWN((n) + (m) - 1, (m)) +static inline bool is_power_of_2(uint64_t value) +{ + if (!value) { + return 0; + } + + return !(value & (value - 1)); +} + +/* round down to the nearest power of 2*/ +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 |