summaryrefslogtreecommitdiff
path: root/src/util/index.h
diff options
context:
space:
mode:
authorTim King <taking@cs.nyu.edu>2012-04-27 14:47:10 +0000
committerTim King <taking@cs.nyu.edu>2012-04-27 14:47:10 +0000
commitf813ed144b0945334e03bfd769ea3c2cf8b75843 (patch)
treee70c9bddf5445aac50b5080c2b1719e6ffb478e0 /src/util/index.h
parent68237f7d39a03905be4cc133a42083fc3342adb4 (diff)
This merges in the branch cvc4/branches/arithmetic/matrix into trunk.
- Splits the functionality of having a sparse matrix of Ts and a solved matrix of rationals in tableau. - Splits ArithVarSet into DenseMap and CDDenseSet and simplifies the code. - No performance loss!
Diffstat (limited to 'src/util/index.h')
-rw-r--r--src/util/index.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/util/index.h b/src/util/index.h
new file mode 100644
index 000000000..0c8b0a307
--- /dev/null
+++ b/src/util/index.h
@@ -0,0 +1,29 @@
+#include "cvc4_private.h"
+
+#pragma once
+
+#include <stdint.h>
+#include <boost/static_assert.hpp>
+
+namespace CVC4 {
+
+/**
+ * Index is an unsigned integer used for array indexing.
+ *
+ * This gives a standardized type for independent pieces of code to use as an agreement.
+ */
+typedef uint32_t Index;
+
+BOOST_STATIC_ASSERT(sizeof(Index) <= sizeof(size_t));
+BOOST_STATIC_ASSERT(!std::numeric_limits<Index>::is_signed);
+
+/* Discussion: Why is Index a uint32_t instead of size_t (or uint_fast32_t)?
+ *
+ * size_t is a more appropraite choice than uint32_t as the choice is dictated by
+ * uniqueness in arrays and vectors. These correspond to size_t.
+ * However, the using size_t with a sizeof == 8 on 64 bit platforms is noticably
+ * slower. (Limited testing suggests a ~1/16 of running time.)
+ * (Interestingly, uint_fast32_t also has a sizeof == 8 on x86_64. Filthy Liars!)
+ */
+
+}; /* namespace CVC4 */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback