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
<rjones(a)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.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages.
http://libguestfs.org