Open
Conversation
Added a macro to clamp a value within specified bounds.
JasonBrave
requested changes
Mar 30, 2026
Member
JasonBrave
left a comment
There was a problem hiding this comment.
Also you need unit test, create a new file tests/test_math.cpp, add thorough test for each inline function, include corner cases. Add the test C++ file to Makefile at root
- Changed to static inline functions - Added #include <stdint.h>
SAT-oO
requested changes
Mar 31, 2026
- Changed clamp function if statements to be expanded and more readable.
- Added test_math.cpp to Makefile
JasonBrave
requested changes
Mar 31, 2026
- Sorted TEST_SRCS by alphabetical order in Makefile
JasonBrave
requested changes
Apr 2, 2026
Member
JasonBrave
left a comment
There was a problem hiding this comment.
You need to add float32_t and float64_t 's typedef to common.h, make sure to add static assert to make sure they have corrent width
Then move the clamp functions to a new "mathops.h"
03a297a to
221dfe1
Compare
…t width checks. Moved clamp functions to mathops.h. Added mathops.h to Makefile. Changed test_math.cpp to use float32_t.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added a macro to clamp a value within specified bounds.