forked from spotify/echoprint-codegen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommon.h
More file actions
55 lines (43 loc) · 960 Bytes
/
Common.h
File metadata and controls
55 lines (43 loc) · 960 Bytes
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//
#ifndef COMMON_H
#define COMMON_H
#include <assert.h>
#ifndef _WIN32
#include <sys/time.h>
#else
#include "win_funcs.h"
#include <sys/types.h>
/* for STL*/
#ifdef max
#undef max
#endif
#ifdef min
#undef min
#endif
#include <malloc.h>
#endif
#include <float.h>
#include <stdio.h>
#include <stdarg.h>
#ifndef NULL
#define NULL 0
#endif
// Returns the current date in seconds. The precision is in microseconds.
static inline double now (void) {
struct timeval tv;
double now;
gettimeofday (&tv, NULL);
now = 1e-6 * tv.tv_usec + tv.tv_sec;
return now;
}
typedef unsigned int uint;
#define NELEM(array) (sizeof(array) / sizeof(array[0]))
#ifndef _WIN32
#define EN_ARRAY(type,var,size) type var[size]
#else
#define EN_ARRAY(type,var,size) type* var = (type*) _alloca((size)*sizeof(type))
#endif
#endif