Skip to content
Merged
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.

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.

@tmleman in general, we are adding way too long comments everywhere. For example here the first 2 lines are all what we need.

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.

@abonislawski I would even agree with you if it weren't for the fact that a push will trigger a re-run in CI.

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.

fair enough 😃

@wjablon1 wjablon1 Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IMO It is maybe too verbose but still acceptable. But since we are on this topic, I would avoid describing entire flows and referencing other function names if that's possible (especially inside lower-level functions while checking preconditions). Such descriptions could easily become obsolete after refactoring or re-design. So generally I agree with @abonislawski

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

return nibble_map;
}
Expand Down
Loading