Skip to content

components: Fix bit-sel inputs of generic mux/demux when not a power of two - #4739

Merged
grandixximo merged 1 commit into
LinuxCNC:masterfrom
BsAtHome:fix_mux-demux-power-of-two
Oct 31, 2026
Merged

grandixximo merged 1 commit into
LinuxCNC:masterfrom
BsAtHome:fix_mux-demux-power-of-two

Conversation

@BsAtHome

Copy link
Copy Markdown
Contributor

Both mux_generic and demux_generic did not create bit-select pins of multiplex inputs or demultiplex outputs if the number was not a power of two. This PR fixes that issue and always creates enough sel-bit-## pins to select any of the inputs/outputs generated.

Additionally, it fixes a missing test after HAL memory allocation and ensures no signed/unsigned confusion when the select input is combined with the bit select inputs and comparison with the size.

Fixes #4731.

Comment thread src/hal/components/mux_generic.c Resolved
Comment thread src/hal/components/mux_generic.c Resolved
Comment thread src/hal/components/demux_generic.c Resolved
@BsAtHome
BsAtHome force-pushed the fix_mux-demux-power-of-two branch from f15cb3a to 94d4d92 Compare October 30, 2026 10:00
@grandixximo
grandixximo merged commit 537cf2d into LinuxCNC:master Oct 31, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mux_generic / sel calculation off by a bit-shift

2 participants