summaryrefslogtreecommitdiff
path: root/src/common.h
blob: 8f8f3fb83fb26aea0e52ce7220b8530d21d03333 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef MS_COMMON_H
#define MS_COMMON_H

#define HAVE_OPENCL 0
#define MS_VERIFY  0
#define MS_POLAR   0
#define MS_CCZ4    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 /* MS_COMMON_H */