Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/audio/copier/copier_dai.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ static uint32_t bitmask_to_nibble_channel_map(uint8_t bitmask)
channel_count++;
}

/* absent channel is represented as 0xf nibble */
nibble_map |= 0xFFFFFFFF << (channel_count * 4);
/* Absent channel is represented as 0xf nibble. With all 8 channels present the shift count
* would be 32, which is undefined behavior for 32-bit types.
* On Xtensa and x86 architectures this would result in returning 0xffffffff, marking all

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be shortened

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it about the line length or is the comment too extensive in general?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me this is okay. Not everyone may know why this behavior occurs or why this if statement is important.

* channels absent.
*/
if (channel_count < 8)
nibble_map |= 0xFFFFFFFF << (channel_count * 4);

return nibble_map;
}
Expand Down
Loading