summaryrefslogtreecommitdiffstats
path: root/core/vector.h
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-11-25 00:07:54 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-11-25 00:09:40 -0300
commitbc2e8d99e5ae0dbd69e712cc71da3033f5f30139 (patch)
treed836011e3d5873e3ceea328ea3100f3c7719ab99 /core/vector.h
parent7dfba3cda9f13427f9f10a6eefbec52aef62274c (diff)
downloadredot-engine-bc2e8d99e5ae0dbd69e712cc71da3033f5f30139.tar.gz
Made Vector::ptrw explicit for writing, compiler was sometimes using the wrong function,
leading to unnecesary copy on writes and reduced performance.
Diffstat (limited to 'core/vector.h')
-rw-r--r--core/vector.h4
1 files changed, 2 insertions, 2 deletions
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 <class T>
void Vector<T>::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++) {