From d4369a8441bc6d4de5ade21cfb8f81152981d2e1 Mon Sep 17 00:00:00 2001 From: Sebastian Geerken Date: Sun, 2 Mar 2014 11:14:40 +0100 Subject: Some assertions in NotSoSimpleVector. --- lout/misc.hh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'lout') diff --git a/lout/misc.hh b/lout/misc.hh index 2bb28b12..3082f33c 100644 --- a/lout/misc.hh +++ b/lout/misc.hh @@ -421,14 +421,17 @@ public: */ inline T* getRef (int i) const { - if (this->startExtra == -1) + if (this->startExtra == -1) { + assert (i >= 0 && i < this->numMain); return this->arrayMain + i; - else { - if (i < this->startExtra) + } else { + if (i < this->startExtra) { + assert (i >= 0); return this->arrayMain + i; - else if (i >= this->startExtra + this->numExtra) + } else if (i >= this->startExtra + this->numExtra) { + assert (i < this->numMain + this->numExtra); return this->arrayMain + i - this->numExtra; - else + } else return this->arrayExtra1 + i - this->startExtra; } } -- cgit v1.2.3