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

[PATCH v3] api: hints: fix type conversion problem in odp_unlikely() #1970

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

JannePeltonen
Copy link
Collaborator

Convert the argument of odp_unlikely() to boolean before passing it to __builtin_expect() which takes a long int argument. This prevents implementation-defined behaviour when the argument of odp_unlikely() does not fit in a long int. In certain systems with 32-bit long, odp_unlikely() currently turns certain non-zero 64-bit values to zero, breaking the code that is using odp_unlikely().

@odpbuild odpbuild changed the title api: hints: fix type conversion problem in odp_unlikely() [PATCH v1] api: hints: fix type conversion problem in odp_unlikely() Dec 11, 2023
@odpbuild odpbuild changed the title [PATCH v1] api: hints: fix type conversion problem in odp_unlikely() [PATCH v2] api: hints: fix type conversion problem in odp_unlikely() Dec 11, 2023
@psavol psavol added the API Ready API change ready to be merged (with the next API version increment) label Dec 11, 2023
Convert the argument of odp_unlikely() to boolean before passing it
to __builtin_expect() which takes a long int argument. This prevents
implementation-defined behaviour when the argument of odp_unlikely()
does not fit in a long int. In certain systems with 32-bit long,
odp_unlikely() currently turns certain non-zero 64-bit values to zero,
breaking the code that is using odp_unlikely().

Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
@odpbuild odpbuild changed the title [PATCH v2] api: hints: fix type conversion problem in odp_unlikely() [PATCH v3] api: hints: fix type conversion problem in odp_unlikely() Dec 19, 2023
@psavol psavol merged commit 988f0b5 into OpenDataPlane:master Dec 19, 2023
171 checks passed
@JannePeltonen JannePeltonen deleted the odp_unlikely-fix branch December 20, 2023 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Ready API change ready to be merged (with the next API version increment)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants