From bc2e8d99e5ae0dbd69e712cc71da3033f5f30139 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 25 Nov 2017 00:07:54 -0300 Subject: Made Vector::ptrw explicit for writing, compiler was sometimes using the wrong function, leading to unnecesary copy on writes and reduced performance. --- core/vector.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/vector.h') diff --git a/core/vector.h b/core/vector.h index 03eaf65099..a5c4b3b155 100644 --- a/core/vector.h +++ b/core/vector.h @@ -96,7 +96,7 @@ class Vector { void _copy_on_write(); public: - _FORCE_INLINE_ T *ptr() { + _FORCE_INLINE_ T *ptrw() { if (!_ptr) return NULL; _copy_on_write(); return (T *)_get_data(); @@ -361,7 +361,7 @@ template void Vector::remove(int p_index) { ERR_FAIL_INDEX(p_index, size()); - T *p = ptr(); + T *p = ptrw(); int len = size(); for (int i = p_index; i < len - 1; i++) { -- cgit v1.2.3