diff options
-rw-r--r-- | include/qemu/host-utils.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h index 753b9fb89f..ca9f3f021b 100644 --- a/include/qemu/host-utils.h +++ b/include/qemu/host-utils.h @@ -358,6 +358,14 @@ static inline uint64_t revbit64(uint64_t x) } /** + * Return the absolute value of a 64-bit integer as an unsigned 64-bit value + */ +static inline uint64_t uabs64(int64_t v) +{ + return v < 0 ? -v : v; +} + +/** * sadd32_overflow - addition with overflow indication * @x, @y: addends * @ret: Output for sum |