[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [RFC PATCH 24/56] block/qcow2: Change align_offset() to ope
From: |
Markus Armbruster |
Subject: |
[Qemu-block] [RFC PATCH 24/56] block/qcow2: Change align_offset() to operate on uint64_t |
Date: |
Mon, 7 Aug 2017 16:45:28 +0200 |
align_offset() mixes different widths, and its callers pass both
signed and unsigned values. It's best to stick to unsigned when
twiddling bits.
Signed-off-by: Markus Armbruster <address@hidden>
---
block/qcow2.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/block/qcow2.h b/block/qcow2.h
index 96a8d43..0d7043e 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -468,10 +468,9 @@ static inline int offset_to_l2_index(BDRVQcow2State *s,
int64_t offset)
return (offset >> s->cluster_bits) & (s->l2_size - 1);
}
-static inline int64_t align_offset(int64_t offset, int n)
+static inline uint64_t align_offset(uint64_t offset, uint64_t n)
{
- offset = (offset + n - 1) & ~(n - 1);
- return offset;
+ return (offset + n - 1) & ~(n - 1);
}
static inline int64_t qcow2_vm_state_offset(BDRVQcow2State *s)
--
2.7.5
- [Qemu-block] [RFC PATCH 02/56] qdict: New helpers to put and get unsigned integers, (continued)
- [Qemu-block] [RFC PATCH 02/56] qdict: New helpers to put and get unsigned integers, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 06/56] char: Don't truncate -chardev and HMP chardev-add ringbuf size, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 18/56] migration: Make parameter max-bandwidth unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 15/56] migration: Make XBZRLE cache size unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 08/56] dump: Make sizes and addresses unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 24/56] block/qcow2: Change align_offset() to operate on uint64_t,
Markus Armbruster <=
- [Qemu-block] [RFC PATCH 10/56] hmp: Make balloon's argument unsigned, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 23/56] option: Fix type of qemu_opt_set_number() parameter @val, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 07/56] cpus: Make memsave, pmemsave sizes, addresses unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07
- [Qemu-block] [RFC PATCH 12/56] pc-dimm: Make size and address unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07