From ec5bc9c0d345dcc76ebfd557941589216b62f07a Mon Sep 17 00:00:00 2001 From: strangezak Date: Sat, 9 Jun 2018 10:27:40 -0700 Subject: [PATCH] Taking the parameter for the operator[] as a reference. This should allow it to be inlined --- HandmadeMath.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/HandmadeMath.h b/HandmadeMath.h index 2e09984..b0f4026 100644 --- a/HandmadeMath.h +++ b/HandmadeMath.h @@ -316,9 +316,9 @@ typedef union hmm_vec2 float Elements[2]; #ifdef __cplusplus - inline float &operator[](int i) + inline float &operator[](int &Index) { - return Elements[i]; + return Elements[Index]; } #endif } hmm_vec2; @@ -367,9 +367,9 @@ typedef union hmm_vec3 float Elements[3]; #ifdef __cplusplus - inline float &operator[](int i) + inline float &operator[](int &Index) { - return Elements[i]; + return Elements[Index]; } #endif } hmm_vec3; @@ -431,9 +431,9 @@ typedef union hmm_vec4 #endif #ifdef __cplusplus - inline float &operator[](int i) + inline float &operator[](int &Index) { - return Elements[i]; + return Elements[Index]; } #endif } hmm_vec4; @@ -447,9 +447,9 @@ typedef union hmm_mat4 #endif #ifdef __cplusplus - inline hmm_vec4 operator[](int i) + inline hmm_vec4 operator[](const int &Index) { - float* col = Elements[i]; + float* col = Elements[Index]; hmm_vec4 result; result.Elements[0] = col[0];