-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
Update math macros to avoid computing callable arguments more than once #140
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for submitting this.
I left one small comment inline, and I would suggest moving all this code a bit further down, to where the current master defines min and max, in order to both minimize the diff (your current PR moves the definitions of min/max, which increases the diff) and to make sure this code is not inside the extern "C"
block, removing the need for closing and reopening that block, which makes things cleaner as well.
Minimized the diff (I believe) as requested. |
Codecov Report
@@ Coverage Diff @@
## master #140 +/- ##
=======================================
Coverage 96.06% 96.06%
=======================================
Files 14 14
Lines 839 839
=======================================
Hits 806 806
Misses 33 33
Continue to review full report at Codecov.
|
Thanks! It's not exactly as I suggested yet, because:
Ideally, you'd also squash all your commits together into a single commit (except maybe for whitespace-only changes, those would better be in separate commits), not sure if you're familiar with merging commits / rewriting history in git? |
|
…texpr functions in the case of C++. Required in order to avoid conflicts to C++ stdlib. Incorporates some of the changes from arduino/ArduinoCore-API#140 and arduino/ArduinoCore-API@30e4397 Co-Authored-By: Keating Reid <[email protected]> Co-Authored-By: Martino Facchin <[email protected]>
…texpr functions in the case of C++. Required in order to avoid conflicts to C++ stdlib. Incorporates some of the changes from arduino/ArduinoCore-API#140 and arduino/ArduinoCore-API@30e4397 Co-Authored-By: Keating Reid <[email protected]> Co-Authored-By: Martino Facchin <[email protected]>
This PR updates various math macros to avoid computing callable arguments more than once using the same technique that the
max
macro currently does. It also replaces them with C++ template functions when__cplusplus
is defined. I originally opened this as in the ArduinoCore-avr repo, but was directed here.