-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Adding SDL_Assume macro to give hint to the optimiser #6309
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
base: main
Are you sure you want to change the base?
Conversation
Gcc case: Msvc case: As I remember, |
oh I did not know you supported sdk so far back... |
Well, my every-day machine runs on an old CentOS-6.10 and it comes with gcc 4.4.7. |
A silly question from me: can we not just add the assume keywords to SDL_assert itself? Clang's static analyzer already uses SDL_assert as an assumption that the asserted case must be true (that the analyzer_noreturn part in SDL_assert.h). |
(Err...and add some preprocessor magic to keep the assumptions when assertions are disabled, to be clear.) |
This seems like a good idea. |
with a given condition generating less instructions.
Ah ignore my last commit I did not see @icculus wanted to take over. |
You can keep going, I haven't looked at this in a year, and just want to make sure I pay attention to it soon. :) |
The thing is , looking at it now, I m not sure we can just use SDL_assume like SDL_assert ... on clang. |
Do we have any benchmarks showing that this provides any benefit? I'd hate to add something to the API that people will start using to improve their code if it doesn't actually help. |
with a given condition generating less instructions.