18
18
19
19
#ifndef PANDAS_INLINE
20
20
#if defined(__GNUC__ )
21
- #define PANDAS_INLINE __inline__
21
+ #define PANDAS_INLINE static __inline__
22
22
#elif defined(_MSC_VER )
23
- #define PANDAS_INLINE __inline
23
+ #define PANDAS_INLINE static __inline
24
24
#elif defined (__STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L
25
- #define PANDAS_INLINE inline
25
+ #define PANDAS_INLINE static inline
26
26
#else
27
27
#define PANDAS_INLINE
28
28
#endif
29
29
#endif
30
30
31
- PANDAS_INLINE static float __skiplist_nanf (void )
31
+ PANDAS_INLINE float __skiplist_nanf (void )
32
32
{
33
33
const union { int __i ; float __f ;} __bint = {0x7fc00000UL };
34
34
return __bint .__f ;
35
35
}
36
36
#define PANDAS_NAN ((double) __skiplist_nanf())
37
37
38
38
39
- static PANDAS_INLINE double Log2 (double val ) {
39
+ PANDAS_INLINE double Log2 (double val ) {
40
40
return log (val ) / log (2. );
41
41
}
42
42
@@ -59,15 +59,15 @@ typedef struct {
59
59
int maxlevels ;
60
60
} skiplist_t ;
61
61
62
- static PANDAS_INLINE double urand (void ) {
62
+ PANDAS_INLINE double urand (void ) {
63
63
return ((double ) rand () + 1 ) / ((double ) RAND_MAX + 2 );
64
64
}
65
65
66
- static PANDAS_INLINE int int_min (int a , int b ) {
66
+ PANDAS_INLINE int int_min (int a , int b ) {
67
67
return a < b ? a : b ;
68
68
}
69
69
70
- static PANDAS_INLINE node_t * node_init (double value , int levels ) {
70
+ PANDAS_INLINE node_t * node_init (double value , int levels ) {
71
71
node_t * result ;
72
72
result = (node_t * ) malloc (sizeof (node_t ));
73
73
if (result ) {
@@ -88,11 +88,11 @@ static PANDAS_INLINE node_t *node_init(double value, int levels) {
88
88
}
89
89
90
90
// do this ourselves
91
- static PANDAS_INLINE void node_incref (node_t * node ) {
91
+ PANDAS_INLINE void node_incref (node_t * node ) {
92
92
++ (node -> ref_count );
93
93
}
94
94
95
- static PANDAS_INLINE void node_decref (node_t * node ) {
95
+ PANDAS_INLINE void node_decref (node_t * node ) {
96
96
-- (node -> ref_count );
97
97
}
98
98
@@ -115,7 +115,7 @@ static void node_destroy(node_t *node) {
115
115
}
116
116
}
117
117
118
- static PANDAS_INLINE void skiplist_destroy (skiplist_t * skp ) {
118
+ PANDAS_INLINE void skiplist_destroy (skiplist_t * skp ) {
119
119
if (skp ) {
120
120
node_destroy (skp -> head );
121
121
free (skp -> tmp_steps );
@@ -124,7 +124,7 @@ static PANDAS_INLINE void skiplist_destroy(skiplist_t *skp) {
124
124
}
125
125
}
126
126
127
- static PANDAS_INLINE skiplist_t * skiplist_init (int expected_size ) {
127
+ PANDAS_INLINE skiplist_t * skiplist_init (int expected_size ) {
128
128
skiplist_t * result ;
129
129
node_t * NIL , * head ;
130
130
int maxlevels , i ;
@@ -163,7 +163,7 @@ static PANDAS_INLINE skiplist_t *skiplist_init(int expected_size) {
163
163
}
164
164
165
165
// 1 if left < right, 0 if left == right, -1 if left > right
166
- static PANDAS_INLINE int _node_cmp (node_t * node , double value ){
166
+ PANDAS_INLINE int _node_cmp (node_t * node , double value ){
167
167
if (node -> is_nil || node -> value > value ) {
168
168
return -1 ;
169
169
}
@@ -175,7 +175,7 @@ static PANDAS_INLINE int _node_cmp(node_t* node, double value){
175
175
}
176
176
}
177
177
178
- static PANDAS_INLINE double skiplist_get (skiplist_t * skp , int i , int * ret ) {
178
+ PANDAS_INLINE double skiplist_get (skiplist_t * skp , int i , int * ret ) {
179
179
node_t * node ;
180
180
int level ;
181
181
@@ -199,7 +199,7 @@ static PANDAS_INLINE double skiplist_get(skiplist_t *skp, int i, int *ret) {
199
199
return node -> value ;
200
200
}
201
201
202
- static PANDAS_INLINE int skiplist_insert (skiplist_t * skp , double value ) {
202
+ PANDAS_INLINE int skiplist_insert (skiplist_t * skp , double value ) {
203
203
node_t * node , * prevnode , * newnode , * next_at_level ;
204
204
int * steps_at_level ;
205
205
int size , steps , level ;
@@ -253,7 +253,7 @@ static PANDAS_INLINE int skiplist_insert(skiplist_t *skp, double value) {
253
253
return 1 ;
254
254
}
255
255
256
- static PANDAS_INLINE int skiplist_remove (skiplist_t * skp , double value ) {
256
+ PANDAS_INLINE int skiplist_remove (skiplist_t * skp , double value ) {
257
257
int level , size ;
258
258
node_t * node , * prevnode , * tmpnode , * next_at_level ;
259
259
node_t * * chain ;
0 commit comments