summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2018-02-05 11:01:35 +0100
committerHisham Muhammad <hisham@gobolinux.org>2018-02-05 11:01:35 +0100
commitf37a050d3d0c6928b09d9b19e1283a695c52ccc7 (patch)
tree5eb816b52f4de1f6ac4e5e7c2b55dc056bb639a7
parent03f17688ada3800bdd344ec4397f81289977b153 (diff)
Optimize Vector_size on non-debug builds
-rw-r--r--Vector.c8
-rw-r--r--Vector.h8
2 files changed, 16 insertions, 0 deletions
diff --git a/Vector.c b/Vector.c
index 0cdf9af2..6eb91ae6 100644
--- a/Vector.c
+++ b/Vector.c
@@ -284,11 +284,19 @@ inline Object* Vector_get(Vector* this, int idx) {
#endif
+#ifdef DEBUG
+
inline int Vector_size(Vector* this) {
assert(Vector_isConsistent(this));
return this->items;
}
+#else
+
+#define Vector_size(v_) ((v_)->items)
+
+#endif
+
/*
static void Vector_merge(Vector* this, Vector* v2) {
diff --git a/Vector.h b/Vector.h
index 9b284778..85939bf1 100644
--- a/Vector.h
+++ b/Vector.h
@@ -70,8 +70,16 @@ extern Object* Vector_get(Vector* this, int idx);
#endif
+#ifdef DEBUG
+
extern int Vector_size(Vector* this);
+#else
+
+#define Vector_size(v_) ((v_)->items)
+
+#endif
+
/*
*/

© 2014-2024 Faster IT GmbH | imprint | privacy policy