<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Aug 13, 2018 at 8:54 PM Eric Blake <<a href="mailto:eblake@redhat.com">eblake@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 08/03/2018 02:28 PM, Nir Soffer wrote:<br></blockquote><div>... </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> +/* Return true if size is a multiple of align. align must be power of 2.<br>
> + *<br>
> + * Suggested by Eric Blake.  See:<br>
> + * <a href="https://www.redhat.com/archives/libguestfs/2018-August/msg00036.html" rel="noreferrer" target="_blank">https://www.redhat.com/archives/libguestfs/2018-August/msg00036.html</a><br>
<br>
Do we need this comment in the code? I'm fine if it is just in the <br>
commit message.<br></blockquote><div><br></div><div>I tried to match other code in common/includes, but we can remove it.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> + */<br>
> +static inline bool<br>
> +is_aligned (unsigned int size, unsigned int align)<br>
> +{<br>
> +  return !(size & (align - 1));<br>
> +}<br>
<br>
Should we assert() that align is indeed a power of 2, to make it harder <br>
for callers to misuse this function?  Otherwise, looks okay to me.<br></blockquote><div><br></div><div>Makes sense to use assert.</div><div><br></div><div>Nir</div></div></div>