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

Copter: Constant comparisons are made first #26901

Conversation

muramura
Copy link
Contributor

The config parameter value does not change.
It is better to check the one whose value does not change first.

@muramura muramura force-pushed the AP_Constant_comparisons_are_made_first branch from 37b4a05 to 2494736 Compare April 27, 2024 12:16
@peterbarker
Copy link
Contributor

You are correct that it is more economical to do the checks in the order you've put them in.

However, the number of times this check has not had to run both halves (and succeeded), ever, on the planet is probably in the hundreds. After all, this is an pre-arm check, and the user has had to mis-configure their vehicle to fail the check.

The change occludes history in the file.

The costs and risks associated with such a patch just don't add up to this being a good deal, sorry.

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