1 #ifndef TAI_H
2 #define TAI_H
3 
4 #ifdef __WINDOWS__
5 typedef __int64 int64_t;
6 typedef unsigned __int64 uint64_t;
7 #else
8 #include <inttypes.h>			/* more portable than stdint.h */
9 #endif
10 
11 #if defined(__WINDOWS__) && !defined(__GNUC__)
12 #define LL(x)  x ## i64
13 #define ULL(x) x ## ui64
14 #else
15 #define LL(x)  x ## LL
16 #define ULL(x) x ## ULL
17 #endif
18 
19 struct tai {
20   uint64_t x;
21 } ;
22 
23 extern void tai_now(struct tai *t);
24 
25 /* JW: MSVC cannot convert unsigned to double :-( */
26 #define tai_approx(t) ((double) ((int64_t)(t)->x))
27 
28 extern void tai_add(struct tai *t, struct tai *u, struct tai *v);
29 extern void tai_sub(struct tai *t, struct tai *u, struct tai *v);
30 #define tai_less(t,u) ((t)->x < (u)->x)
31 
32 #define TAI_PACK 8
33 extern void tai_pack(char *s, struct tai *t);
34 extern void tai_unpack(char *s, struct tai *t);
35 
36 #endif
37