From f50c9a31659e9221314e54104af367aa91e9f5cd Mon Sep 17 00:00:00 2001 From: strangezak Date: Mon, 26 Nov 2018 16:40:40 -0800 Subject: [PATCH] Removed copy in operator[] --- HandmadeMath.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/HandmadeMath.h b/HandmadeMath.h index b0c6f5c..75e8718 100644 --- a/HandmadeMath.h +++ b/HandmadeMath.h @@ -324,7 +324,7 @@ typedef union hmm_vec2 float Elements[2]; #ifdef __cplusplus - inline float &operator[](int Index) + inline float &operator[](const int &Index) { return Elements[Index]; } @@ -375,7 +375,7 @@ typedef union hmm_vec3 float Elements[3]; #ifdef __cplusplus - inline float &operator[](int Index) + inline float &operator[](const int &Index) { return Elements[Index]; } @@ -439,7 +439,7 @@ typedef union hmm_vec4 #endif #ifdef __cplusplus - inline float &operator[](int Index) + inline float &operator[](const int &Index) { return Elements[Index]; } @@ -459,7 +459,7 @@ typedef union hmm_mat4 #endif #ifdef __cplusplus - inline hmm_vec4 operator[](const int Index) + inline hmm_vec4 operator[](const int &Index) { float* col = Elements[Index];