On Mon, Aug 13, 2018 at 8:54 PM Eric Blake <eblake@redhat.com> wrote:
On 08/03/2018 02:28 PM, Nir Soffer wrote:
... 
> +/* Return true if size is a multiple of align. align must be power of 2.
> + *
> + * Suggested by Eric Blake.  See:
> + * https://www.redhat.com/archives/libguestfs/2018-August/msg00036.html

Do we need this comment in the code? I'm fine if it is just in the
commit message.

I tried to match other code in common/includes, but we can remove it.
 

> + */
> +static inline bool
> +is_aligned (unsigned int size, unsigned int align)
> +{
> +  return !(size & (align - 1));
> +}

Should we assert() that align is indeed a power of 2, to make it harder
for callers to misuse this function?  Otherwise, looks okay to me.

Makes sense to use assert.

Nir