Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(hgeie): fix macro generation logic for 'HGEIE_MASK' #792

Merged
merged 1 commit into from
Jan 25, 2025

Conversation

Anzooooo
Copy link
Member

We should know that MUXDEF can only be used when the condition is bool.

The reason for this is as follows:

#define CHOOSE2nd(a, b, ...) b
#define MUX_WITH_COMMA(contain_comma, a, b) CHOOSE2nd(contain_comma a, b)
#define MUX_MACRO_PROPERTY(p, macro, a, b) MUX_WITH_COMMA(concat(p, macro), a, b)
// define placeholders for some property
#define __P_DEF_0 X,
#define __P_DEF_1 X,
#define __P_ONE_1 X,
#define __P_ZERO_0 X,
// define some selection functions based on the properties of BOOLEAN macro
#define MUXDEF(macro, X, Y) MUX_MACRO_PROPERTY(_P_DEF, macro, X, Y)
#define MUXNDEF(macro, X, Y) MUX_MACRO_PROPERTY(_P_DEF, macro, Y, X)
#define MUXONE(macro, X, Y) MUX_MACRO_PROPERTY(_P_ONE, macro, X, Y)
#define MUXZERO(macro, X, Y) MUX_MACRO_PROPERTY(_P_ZERO,macro, X, Y)

When macro is defined as non-0/1, then Y will always be selected.

@Tang-Haojin Tang-Haojin merged commit 011307b into master Jan 25, 2025
7 checks passed
@Tang-Haojin Tang-Haojin deleted the fix-hgeie branch January 25, 2025 09:05
Anzooooo added a commit that referenced this pull request Jan 25, 2025
Anzooooo added a commit that referenced this pull request Jan 26, 2025
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.

2 participants