On Tue, Sep 18, 2018 at 12:27 AM Richard W.M. Jones <rjones@redhat.com> wrote:
--- common/include/isaligned.h | 11 +++++------ plugins/file/file.c | 4 ++-- plugins/vddk/vddk.c | 8 ++++---- 3 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/common/include/isaligned.h b/common/include/isaligned.h index e693820..81ce8a7 100644 --- a/common/include/isaligned.h +++ b/common/include/isaligned.h @@ -36,16 +36,15 @@
#include <assert.h> #include <stdbool.h> +#include <stdint.h>
With the macro, stdint.h and stdbool.h are not needed.
#include "ispowerof2.h"
/* Return true if size is a multiple of align. align must be power of 2. */ -static inline bool -is_aligned (unsigned int size, unsigned int align) -{ - assert (is_power_of_2 (align)); - return !(size & (align - 1)); -} +#define IS_ALIGNED(size, align) ({ \ + assert (is_power_of_2 ((align))); \ + !((size) & ((align) - 1)); \ +})
#endif /* NBDKIT_ISALIGNED_H */ ...
Nir