-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Core: Convert Math
class to namespace
#94441
base: master
Are you sure you want to change the base?
Conversation
I assume this change qualifies as codestyle too? Or perhaps I'm missing something. |
Now that you mention it, yeah; this would technically qualify as that. Given that's already the case, might as well fixup stuff like argument name syntax |
130c7f6
to
56158da
Compare
56158da
to
e4a04f1
Compare
e4a04f1
to
0bcc930
Compare
0bcc930
to
0992117
Compare
0992117
to
2b18a0e
Compare
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.
I want to add my two cents that although this causes churn in the code, it's probably worth doing for consistency in Godot Engine.
The pull request passes the GitHub integration tests, so it's more correct.
a4070d2
to
05bcb88
Compare
05bcb88
to
813171b
Compare
This adopts the formatting seen in
godot-cpp
which opts forMath
as a namespace rather than a class. Given the class already shouldn't be instanced, nor did it really utilize any class-specific functionality, functioning as a namespace feels more apt. Beyond the conversion, the only adjustments were:core/math/random_pcg.h
include migrated tomath_funcs.cpp
; explicitly included in the handful of files utilizingRandomPCG
directly.default_rand
, the one private field in the entire class, migrated tomath_funcs.cpp
as a static variable.RANDOM_32BIT_MAX
replaced by existing, equivalent define:UINT32_MAX
.static
declaration removed from all functions.absd
,absf
,is_equal_approx
, andis_zero_approx
moved up—a consequence of needing to be declared before use in a namespace context.math_funcs.{h|cpp}
functions that weren't usingp_*
argument syntax now do.Math::
prefix removed in header where redundant.double
sorted beforefloat
equivalent where applicable.