diff options
author | Anton Khirnov <anton@khirnov.net> | 2019-04-17 14:38:23 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2019-04-19 17:11:40 +0200 |
commit | 5b94910fc4c6a47856290e9c23f9a905cf63c1eb (patch) | |
tree | e33245aef4e7885b801e1a2474c18e1ed9737518 /common.h | |
parent | 8c35e7648cf7db413e1d2a9478edec797eac5df3 (diff) |
Add and use a new timer API.
Diffstat (limited to 'common.h')
-rw-r--r-- | common.h | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -24,16 +24,18 @@ #define MIN(x, y) ((x) > (y) ? (y) : (x)) #define ARRAY_ELEMS(arr) (sizeof(arr) / sizeof(*arr)) +#include <stdio.h> #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; -} #define FD_STENCIL_MAX 4 +#define mg2di_assert(x) \ +do { \ + if (!(x)) { \ + fprintf(stderr, "Assertion " #x " failed\n"); \ + abort(); \ + } \ +} while (0) + #endif /* MG2D_COMMON_H */ |