Skip to content

Commit

Permalink
Rename IS_ALIGN() to SOF_IS_ALIGN()
Browse files Browse the repository at this point in the history
This is the simplest, cheapest and safest to avoid the collision with
the incoming Zephyr macro IS_ALIGN() submitted in
zephyrproject-rtos/zephyr#67243

As SOF depends on Zephyr, most SOF symbols should be prefixed SOF_ or
something specific.

This is compliant with:
https://docs.zephyrproject.org/latest/contribute/coding_guidelines/index.html#rule-a-3-macro-name-collisions

Signed-off-by: Marc Herbert <[email protected]>
  • Loading branch information
marc-hb committed Jan 17, 2024
1 parent 789fb7f commit d9cafac
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/audio/dai-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ static int dai_set_sg_config(struct dai_data *dd, struct comp_dev *dev, uint32_t
period_count);
buf_size = period_count * period_bytes;
do {
if (IS_ALIGNED(buf_size, max_block_count)) {
if (SOF_IS_ALIGNED(buf_size, max_block_count)) {
period_count = max_block_count;
period_bytes = buf_size / period_count;
break;
Expand Down
6 changes: 3 additions & 3 deletions src/audio/kpb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1895,7 +1895,7 @@ static void kpb_convert_24b_to_32b(const void *linear_source, int ioffset,
int i = 0;
ae_int24x2 d24 = AE_ZERO24();

if (!IS_ALIGNED((uintptr_t)out_ptr, 8)) {
if (!SOF_IS_ALIGNED((uintptr_t)out_ptr, 8)) {
AE_LA24_IP(d24, align_in, in);
ae_int32x2 d320 = d24;
int higher = AE_MOVAD32_H(d320);
Expand Down Expand Up @@ -1996,7 +1996,7 @@ static void kpb_convert_32b_to_24b(const struct audio_stream *source, int ioffse
ae_f24x2 vs = AE_ZERO24();
ae_valign align_out = AE_ZALIGN64();

if (!IS_ALIGNED((uintptr_t)sin, 8)) {
if (!SOF_IS_ALIGNED((uintptr_t)sin, 8)) {
AE_L32F24_XC(vs, (const ae_f24 *)sin, 4);
AE_SA24_IP(vs, align_out, sout);
n_samples--;
Expand Down Expand Up @@ -2154,7 +2154,7 @@ static void kpb_copy_24b_in_32b(const struct audio_stream *source, uint32_t ioff
ae_int32x2 *sout = (ae_int32x2 *)out;
ae_int32x2 vs = AE_ZERO32();

if (!IS_ALIGNED((uintptr_t)sin, 8)) {
if (!SOF_IS_ALIGNED((uintptr_t)sin, 8)) {
AE_L32_IP(vs, (const ae_int32 *)sin, 4);
AE_S32_L_IP(vs, (ae_int32 *)sout, 4);
n_samples--;
Expand Down
2 changes: 1 addition & 1 deletion src/include/sof/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#define __must_check __attribute__((warn_unused_result))

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

/* 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 d9cafac

Please sign in to comment.