summaryrefslogtreecommitdiff
path: root/src/util/gmp_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/gmp_util.h')
-rw-r--r--src/util/gmp_util.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/util/gmp_util.h b/src/util/gmp_util.h
new file mode 100644
index 000000000..1849974cd
--- /dev/null
+++ b/src/util/gmp_util.h
@@ -0,0 +1,28 @@
+/*
+ * gmp.h
+ *
+ * Created on: Apr 5, 2010
+ * Author: dejan
+ */
+
+#ifndef __CVC4__GMP_H_
+#define __CVC4__GMP_H_
+
+#include <gmpxx.h>
+
+namespace CVC4 {
+
+ /** Hashes the gmp integer primitive in a word by word fashion. */
+ inline size_t gmpz_hash(const mpz_t toHash) {
+ size_t hash = 0;
+ for (int i=0, n=mpz_size(toHash); i<n; ++i){
+ mp_limb_t limb = mpz_getlimbn(toHash, i);
+ hash = hash * 2;
+ hash = hash xor limb;
+ }
+ return hash;
+ }
+
+}
+
+#endif /* __CVC4__GMP_H_ */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback