Conversation
Use memcpy (which might be faster depending on the platform being used) and use 'const' for elements not being modified in functions
| mfloat_t *vec3_cross(mfloat_t *result, mfloat_t *v0, mfloat_t *v1) | ||
| mfloat_t *vec3_cross(mfloat_t *result, const mfloat_t *v0, const mfloat_t *v1) | ||
| { | ||
| mfloat_t cross[VEC3_SIZE]; |
There was a problem hiding this comment.
In this specific case the local variable cross[] is not nessary and the results can directly be written into result[]
|
Hi, sorry for the late response, I was traveling and taking care of changes in life. Some operations mix components, such as rotation, which means a buffer is necessary for them. I decided to keep a style that is consistent across the entire library, which allows to do this without worrying: I think |
|
Maybe you can provide a simple Then use |
|
Wouldn't even embedded targets with very restricted libc's usually have |
With Microsoft compiler, you can avoid the use of any CRT by just defining |
Use memcpy (which might be faster depending on the platform being used) and use 'const' for elements not being modified in functions.
This is proof-of-concept diff, of course the function prototype in mathc.h needs to be modified as well, and it requires a rewrite of other functions as well.