summaryrefslogtreecommitdiff
path: root/src/common.h
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2018-04-07 18:13:49 +0200
committerAnton Khirnov <anton@khirnov.net>2018-04-07 18:13:49 +0200
commitd53f73b7f7c728e96ffc07b55fa30b9e6fc5121c (patch)
treec79d588e646ea3e65b2db1532d65bb691ee88b0e /src/common.h
Initial commit.
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h
new file mode 100644
index 0000000..2b1ebf6
--- /dev/null
+++ b/src/common.h
@@ -0,0 +1,29 @@
+#ifndef MD_COMMON_H
+#define MD_COMMON_H
+
+#define HAVE_OPENCL 0
+#define MD_VERIFY 0
+#define MD_POLAR 0
+
+#define SQR(x) ((x) * (x))
+#define SGN(x) ((x) >= 0.0 ? 1.0 : -1.0)
+#define MAX(x, y) ((x) > (y) ? (x) : (y))
+#define MIN(x, y) ((x) > (y) ? (y) : (x))
+#define ARRAY_ELEMS(arr) (sizeof(arr) / sizeof(*arr))
+
+/*
+ * small number to avoid r=0 singularities
+ */
+#define EPS 1E-08
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <sys/time.h>
+static inline int64_t gettime(void)
+{
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
+}
+
+#endif /* MD_COMMON_H */