Skip to content

Commit

Permalink
common.h: Guard definition of IS_ALIGNED for Zephyr builds
Browse files Browse the repository at this point in the history
common.h defines the IS_ALIGNED macro, which conflicts with
a Zephyr macro of the same name. Add guards to define it only
if it is not already defined by Zephyr.

Signed-off-by: Yonatan Schachter <[email protected]>
  • Loading branch information
yonsch authored and kv2019i committed Jan 16, 2024
1 parent f4ce8b5 commit 0a3b816
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/include/sof/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@
/* callers must check/use the return value */
#define __must_check __attribute__((warn_unused_result))

#ifdef __ZEPHYR__
#include <zephyr/sys/util.h>
#endif

/* Align the number to the nearest alignment value */
#ifndef IS_ALIGNED
#define IS_ALIGNED(size, alignment) ((size) % (alignment) == 0)
#endif

/* Treat zero as a special case because it wraps around */
#define is_power_of_2(x) ((x) && !((x) & ((x) - 1)))
Expand Down

0 comments on commit 0a3b816

Please sign in to comment.