Skip to content

Commit 17d0b23

Browse files
committed
Move PANDAS_INLINE detection outside to khash_python.h
1 parent d4ccf37 commit 17d0b23

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

pandas/src/klib/khash.h

+9-13
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,13 @@ typedef signed long long khint64_t;
148148

149149
typedef double khfloat64_t;
150150

151-
#ifndef PANDAS_INLINE
152-
#if defined(__GNUC__)
153-
#define PANDAS_INLINE __inline__
154-
#elif defined(_MSC_VER)
155-
#define PANDAS_INLINE __inline
156-
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
157-
#define PANDAS_INLINE inline
158-
#else
159-
#define PANDAS_INLINE
160-
#endif
151+
#ifndef kh_inline
152+
#ifdef _MSC_VER
153+
#define kh_inline __inline
154+
#else
155+
#define kh_inline inline
161156
#endif
157+
#endif /* kh_inline */
162158

163159
typedef khint32_t khint_t;
164160
typedef khint_t khiter_t;
@@ -358,7 +354,7 @@ static const double __ac_HASH_UPPER = 0.77;
358354
__KHASH_IMPL(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)
359355

360356
#define KHASH_INIT(name, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \
361-
KHASH_INIT2(name, static PANDAS_INLINE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)
357+
KHASH_INIT2(name, static kh_inline, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)
362358

363359
/* --- BEGIN OF HASH FUNCTIONS --- */
364360

@@ -388,7 +384,7 @@ static const double __ac_HASH_UPPER = 0.77;
388384
@param s Pointer to a null terminated string
389385
@return The hash value
390386
*/
391-
static PANDAS_INLINE khint_t __ac_X31_hash_string(const char *s)
387+
static kh_inline khint_t __ac_X31_hash_string(const char *s)
392388
{
393389
khint_t h = (khint_t)*s;
394390
if (h) for (++s ; *s; ++s) h = (h << 5) - h + (khint_t)*s;
@@ -405,7 +401,7 @@ static PANDAS_INLINE khint_t __ac_X31_hash_string(const char *s)
405401
*/
406402
#define kh_str_hash_equal(a, b) (strcmp(a, b) == 0)
407403

408-
static PANDAS_INLINE khint_t __ac_Wang_hash(khint_t key)
404+
static kh_inline khint_t __ac_Wang_hash(khint_t key)
409405
{
410406
key += ~(key << 15);
411407
key ^= (key >> 10);

pandas/src/klib/khash_python.h

+13
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@
33

44
#include <Python.h>
55

6+
#ifndef PANDAS_INLINE
7+
#if defined(__GNUC__)
8+
#define PANDAS_INLINE __inline__
9+
#elif defined(_MSC_VER)
10+
#define PANDAS_INLINE __inline
11+
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12+
#define PANDAS_INLINE inline
13+
#else
14+
#define PANDAS_INLINE
15+
#endif
16+
#endif
17+
18+
#define kh_inline PANDAS_INLINE
619
#include "khash.h"
720

821
#define kh_exist_str(h, k) (kh_exist(h, k))

0 commit comments

Comments
 (0)