From 950cc4e97fdffeaa00c6e2499529f2b040a050b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B5=D0=BB=D0=B8=D0=BF=D0=B5=D0=BD=D0=BA=D0=BE=20?= =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD?= Date: Tue, 26 May 2015 06:55:18 +0000 Subject: [PATCH] PIMathVectorT optimize state git-svn-id: svn://db.shs.com.ru/pip@136 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- src/io/pibinarylog.cpp | 2 +- src/math/pimathvector.h | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/io/pibinarylog.cpp b/src/io/pibinarylog.cpp index 7d14ba9d..61847458 100644 --- a/src/io/pibinarylog.cpp +++ b/src/io/pibinarylog.cpp @@ -142,7 +142,7 @@ bool PIBinaryLog::threadedRead(uchar *readed, int size) { break; case PlayVariableSpeed: delay = lastrecord.timestamp.toMilliseconds() - play_time; - piCoutObj << "delay" << delay; + //piCoutObj << "delay" << delay; double cdelay; int dtc; if (is_started) { diff --git a/src/math/pimathvector.h b/src/math/pimathvector.h index 8330c6dc..6e5667d1 100644 --- a/src/math/pimathvector.h +++ b/src/math/pimathvector.h @@ -38,11 +38,11 @@ template class PIP_EXPORT PIMathVectorT { typedef PIMathVectorT _CVector; public: - PIMathVectorT() {resize(Size);} + PIMathVectorT() {resize();} //PIMathVectorT(Type val) {resize(Size); PIMV_FOR(i, 0) c[i] = val;} - PIMathVectorT(Type fval, ...) {resize(Size); c[0] = fval; va_list vl; va_start(vl, fval); PIMV_FOR(i, 1) c[i] = va_arg(vl, Type); va_end(vl);} - PIMathVectorT(const PIVector & val) {resize(Size); PIMV_FOR(i, 0) c[i] = val[i];} - PIMathVectorT(const _CVector & st, const _CVector & fn) {resize(Size); set(st, fn);} + PIMathVectorT(Type fval, ...) {resize(); c[0] = fval; va_list vl; va_start(vl, fval); PIMV_FOR(i, 1) c[i] = va_arg(vl, Type); va_end(vl);} + PIMathVectorT(const PIVector & val) {resize(); PIMV_FOR(i, 0) c[i] = val[i];} + PIMathVectorT(const _CVector & st, const _CVector & fn) {resize(); set(st, fn);} uint size() const {return Size;} _CVector & fill(const Type & v) {PIMV_FOR(i, 0) c[i] = v; return *this;} @@ -107,9 +107,8 @@ public: PIMathVectorT turnTo() {PIMathVectorT tv; uint sz = piMin(Size, Size1); for (uint i = 0; i < sz; ++i) tv[i] = c[i]; return tv;} private: - void resize(uint size, const Type & new_value = Type()) {s = size; for (int i = 0; i < s; ++i) c[i] = new_value;} + void resize(const Type & new_value = Type()) {for (int i = 0; i < Size; ++i) c[i] = new_value;} - int s; Type c[Size]; };