Open recp opened 3 years ago
What about declaring the type upfront? That way the implementation would be the same, and the user chooses between float/double precision before including cglm.h, or with a compilation flag.
This library does something similar:
https://github.com/felselva/mathc/blob/d672725203fc80f6f79fba64533b87d51c32d714/mathc.h#L133
What if we need both? I think it would be nice to keep both, or add enable/disable compilation flag to reduce binary size maybe. I still think we should keep them in separate namespace e.g. glm64_
or dmat4_
... to keep things consistent. Replacing float
to double
is not enough, there are SIMD functions, types, sub func calls ...
Yes, I see, I missread the patch. Forget about it then.
Function names are not HIDDEN in macro, in this way we can use 'Go To Definition' in IDEs. With making raw implementation Macro/Template allows us to implement
double
precision with no cost (copy-paste only). Individual types can implement SIMD separately like below; float impl used SIMD since double does not (for now).Also exposing SCALAR/RAW implementation will allow us to compare SIMD versions with SCALAR versions in TESTS which we must do.
Here is the proposal:
Hiding function names like
glm_mat4_inv()
in impl MACRO may cause hard to read I think.Feedbacks are welcome