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

what for max() function? #5

Open
mistepien opened this issue Aug 1, 2023 · 3 comments
Open

what for max() function? #5

mistepien opened this issue Aug 1, 2023 · 3 comments

Comments

@mistepien
Copy link

Why in library max() function is used

word SegaController::getState() { if (max(millis() - _lastReadTime, 0) < SC_READ_DELAY_MS)

instead of

word SegaController::getState() { if ((millis() - _lastReadTime) < SC_READ_DELAY_MS) {

What is a gain of using max() function?

@Kyle2309
Copy link

Kyle2309 commented Sep 7, 2023

Safer experience?

@mistepien
Copy link
Author

Safer how?

@jonthysell
Copy link
Owner

I think when I wrote this I just didn't realize it'd still work with the overflow wraparound.

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

No branches or pull requests

3 participants