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

Use likely() in PtrToArg<T *> when checking for null Object *s #90394

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

dsnopek
Copy link
Contributor

@dsnopek dsnopek commented Apr 8, 2024

In godotengine/godot-cpp#1405, @reduz requested that likely() be added to PtrToArg<T *> when checking for null Object *s in godot-cpp.

This is doing the same thing for the equivalent code in Godot, so that we are consistent between Godot and godot-cpp.

I also switched to using a ternary to match the godot-cpp code. I'd be fine going the other way and switching godot-cpp to use an if-statement, but however we do it, it'd be nice to be somewhat consistent. (Unfortunately, the casts can't be made consistent due to other differences.)

Copy link
Member

@AThousandShips AThousandShips left a comment

Choose a reason for hiding this comment

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

LGTM

@akien-mga akien-mga merged commit ef48114 into godotengine:master Apr 30, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@dsnopek dsnopek deleted the object-ptrcall-null-unlikely branch July 22, 2024 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants