On 9/17/18 2:55 PM, Richard W.M. Jones wrote:
On Mon, Sep 17, 2018 at 10:00:30PM +0300, Nir Soffer wrote:
On Mon, Sep 17, 2018 at 6:03 PM Richard W.M. Jones <rjo...@redhat.com>
wrote:

This should have no effect.  However it's probably better to pass the
full type explicitly rather than using an implicit truncation.


Why is it better?

It's not necessarily, hence patches are posted for review :-)

My other idea was to turn it into a macro, something like this:

   #define is_aligned(size, align) (!((size) & ((align) - 1)))

This, I believe, is independent of the int type used by the caller so
achieves the same end.  However it unfortunately drops the assertion
and I couldn't think of a good way to add the assertion to this
expression without using GCC extensions.

Then again, we already rely on gcc/clang features (such as automatic variable cleanup on scope exit), so it's highly probable that any such extension we use is already supported by any compiler that can already grok nbdkit sources.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to