mirror of
https://github.com/HandmadeMath/HandmadeMath.git
synced 2025-12-28 07:34:32 +00:00
* Convert everything to new inline scheme * Add both extern and inline for some SSE vs. non-SSE functions Some functions had nice, compact SSE implementations but bulky non-SSE implementations, so this commit inlines just the implementations that make sense. Also updated documentation. * Convert HINLINE and HEXTERN to HMM_INLINE and HMM_EXTERN
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
# Understanding the structure of Handmade Math
|
||||
|
||||
Most of the functions in Handmade Math are very short, and are the kind of functions you want to have inlined. Because of this, most functions in Handmade Math are defined with `HINLINE`, which is defined as `static inline`.
|
||||
|
||||
The exceptions are functions like `HMM_Rotate`, which are long enough that it doesn't make sense to inline them. These functions are defined with an `HEXTERN` prototype, and implemented in the `#ifdef HANDMADE_MATH_IMPLEMENTATION` block.
|
||||
|
||||
# Quick style guide
|
||||
|
||||
* Put braces on a new line
|
||||
@@ -13,23 +19,6 @@
|
||||
1.f
|
||||
.0f
|
||||
```
|
||||
* Put macros and return types on a separate line from the function definition:
|
||||
```cpp
|
||||
HINLINE float
|
||||
HMM_MyFunction()
|
||||
{
|
||||
// ...
|
||||
}
|
||||
```
|
||||
* Explicitly initialize variables to zero:
|
||||
```cpp
|
||||
HINLINE float
|
||||
HMM_MyFunction()
|
||||
{
|
||||
float MyFloat = 0.0f;
|
||||
hmm_vec3 MyVector = {0};
|
||||
}
|
||||
```
|
||||
* Put parentheses around the returned value:
|
||||
```cpp
|
||||
HINLINE float
|
||||
|
||||
3724
HandmadeMath.h
3724
HandmadeMath.h
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,7 @@ _This library is free and will stay free, but if you would like to support devel
|
||||
|
||||
Version | Changes |
|
||||
----------------|----------------|
|
||||
**1.5.0** | Changed internal structure for better performance and inlining. As a result, `HANDMADE_MATH_NO_INLINE` has been removed and no longer has any effect.
|
||||
**1.4.0** | Fixed bug when using C mode. SSE'd all vec4 operations. Removed zeroing for better performance.
|
||||
**1.3.0** | Removed need to `#define HANDMADE_MATH_CPP_MODE`. C++ definitions are now included automatically in C++ environments.
|
||||
**1.2.0** | Added equality functions for `HMM_Vec2`, `HMM_Vec3`, and `HMM_Vec4`, and SSE'd `HMM_MultiplyMat4` and `HMM_Transpose`.
|
||||
|
||||
Reference in New Issue
Block a user