Skip to content

Convert enabledCommands array to use command index and some other improvements#569

Merged
stefanberger merged 3 commits intomasterfrom
stefanberger/redo_command_arrays
Mar 9, 2026
Merged

Convert enabledCommands array to use command index and some other improvements#569
stefanberger merged 3 commits intomasterfrom
stefanberger/redo_command_arrays

Conversation

@stefanberger
Copy link
Copy Markdown
Owner

No description provided.

Base the enabledCommands array on the command index rather than the command
code since the latter left the first few bytes always unused since command
codes start at 0x11f only.

After this change, ppList, auditCommands, and enabledCommandsByIdx bitmaps
are all based on command indices.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Use __builtin_popcount for counting the number of enabled commands in the
enabledCommandsByIdx bitmap.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Only write the necessary number of bytes of the ppList and auditCommands
bitmaps. The entries in both of these bitmaps are set by a command's
index and the necessary number of bytes can be determined by finding the
command with the highest command code that is enabled in the current
profile (1). This in turn can be found by by searching for the last byte
in the enableCommandsByIdx bitmap that has any bit set.

1) It would be possible to skip writing these arrays entirely if they have
   no bits set. The unmarshalling functions would clear the arrays.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
@stefanberger stefanberger merged commit 5098f2c into master Mar 9, 2026
4 checks passed
@stefanberger stefanberger deleted the stefanberger/redo_command_arrays branch March 9, 2026 19:08
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.

1 participant