Skip to content

Commit 2512698

Browse files
marc-hbkv2019i
authored andcommitted
numbers.sh: do not (re)define ROUND_DOWN() if __ZEPHYR__
Move the ROUND_DOWN() definition to the nearby #ifndef __ZEPHYR__ block. The previous `#ifndef ROUND_DOWN` logic depends on the #include order, so it fails sometimes. Fixes commit a6f8dae ("kpb: add micselection function") Fixes XCC compilation failure with ``` ./scripts/xtensa-build-zephyr.py mtl --cmake-args='-DEXTRA_CFLAGS=-Werror' - In file included from sof/src/audio/src/src_hifi4.c:22: zephyr/include/zephyr/sys/util.h:238:9: warning: 'ROUND_DOWN' macro redefined [-Wmacro-redefined] ^ sof/zephyr/../src/include/sof/math/numbers.h:33:9: note: previous definition is here ``` Signed-off-by: Marc Herbert <marc.herbert@intel.com>
1 parent c7e98ee commit 2512698

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/include/sof/math/numbers.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
*/
1919
#define MIN(a, b) ((a) < (b) ? (a) : (b))
2020
#define MAX(a, b) ((a) < (b) ? (b) : (a))
21+
22+
#define ROUND_DOWN(size, alignment) ({ \
23+
typeof(size) __size = (size); \
24+
typeof(alignment) __alignment = (alignment); \
25+
__size - (__size % __alignment); \
26+
})
2127
#endif /* ! __ZEPHYR__ */
2228

2329
#define ABS(a) ({ \
@@ -29,13 +35,7 @@
2935
__a < 0 ? -1 : \
3036
__a > 0 ? 1 : 0; \
3137
})
32-
#ifndef ROUND_DOWN
33-
#define ROUND_DOWN(size, alignment) ({ \
34-
typeof(size) __size = (size); \
35-
typeof(alignment) __alignment = (alignment); \
36-
__size - (__size % __alignment); \
37-
})
38-
#endif /* !ROUND_DOWN */
38+
3939
int gcd(int a, int b); /* Calculate greatest common divisor for a and b */
4040

4141
/* This is a divide function that returns ceil of the quotient.

0 commit comments

Comments
 (0)