From f0fdaa307dd180076f5862a6585a0eb02bcf334a Mon Sep 17 00:00:00 2001 From: Syoyo Fujita Date: Wed, 18 Feb 2015 12:48:50 +0900 Subject: [PATCH] slight change to fixIndex --- tiny_obj_loader.cc | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tiny_obj_loader.cc b/tiny_obj_loader.cc index 992662c..6ba4336 100644 --- a/tiny_obj_loader.cc +++ b/tiny_obj_loader.cc @@ -66,16 +66,9 @@ static inline bool isNewLine(const char c) { // Make index zero-base, and also support relative index. static inline int fixIndex(int idx, int n) { - int i; - - if (idx > 0) { - i = idx - 1; - } else if (idx == 0) { - i = 0; - } else { // negative value = relative - i = n + idx; - } - return i; + if (idx > 0) return idx - 1; + if (idx == 0) return 0; + return n + idx; // negative value = relative } static inline std::string parseString(const char *&token) {