Re: [Qemu-devel] [PATCH] block: Use QEMU_IS_ALIGNED instead of reinventing it

2019-08-20 Thread Nir Soffer
On Tue, Aug 20, 2019 at 10:51 PM Max Reitz wrote: > On 17.08.19 19:53, Nir Soffer wrote: > > Replace instances of: > > > > (n & (BDRV_SECTOR_SIZE - 1)) == 0) > > > > With: > > > > QEMU_IS_ALIGNED(n, BDRV_SECTOR_SIZE) > > > > Which reveals the intent of the code better, and makes it easier

Re: [Qemu-devel] [PATCH] block: Use QEMU_IS_ALIGNED instead of reinventing it

2019-08-20 Thread Max Reitz
On 17.08.19 19:53, Nir Soffer wrote: > Replace instances of: > > (n & (BDRV_SECTOR_SIZE - 1)) == 0) > > With: > > QEMU_IS_ALIGNED(n, BDRV_SECTOR_SIZE) > > Which reveals the intent of the code better, and makes it easier to > locate the code checking alignment. > > QEMU_IS_ALIGNED is im

[Qemu-devel] [PATCH] block: Use QEMU_IS_ALIGNED instead of reinventing it

2019-08-17 Thread Nir Soffer
Replace instances of: (n & (BDRV_SECTOR_SIZE - 1)) == 0) With: QEMU_IS_ALIGNED(n, BDRV_SECTOR_SIZE) Which reveals the intent of the code better, and makes it easier to locate the code checking alignment. QEMU_IS_ALIGNED is implemented using %, which may be less efficient but it is used