Skip to content

Remove inline_helper.h header file #56275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions pandas/_libs/include/pandas/inline_helper.h

This file was deleted.

1 change: 0 additions & 1 deletion pandas/_libs/include/pandas/parser/tokenizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ See LICENSE for the license
#define ERROR_OVERFLOW 2
#define ERROR_INVALID_CHARS 3

#include "pandas/inline_helper.h"
#include "pandas/portable.h"
#include <stdint.h>

Expand Down
29 changes: 14 additions & 15 deletions pandas/_libs/include/pandas/skiplist.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ Python recipe (https://rhettinger.wordpress.com/2010/02/06/lost-knowledge/)

#pragma once

#include "pandas/inline_helper.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

PANDAS_INLINE float __skiplist_nanf(void) {
static inline float __skiplist_nanf(void) {
const union {
int __i;
float __f;
Expand All @@ -30,7 +29,7 @@ PANDAS_INLINE float __skiplist_nanf(void) {
}
#define PANDAS_NAN ((double)__skiplist_nanf())

PANDAS_INLINE double Log2(double val) { return log(val) / log(2.); }
static inline double Log2(double val) { return log(val) / log(2.); }

typedef struct node_t node_t;

Expand All @@ -51,13 +50,13 @@ typedef struct {
int maxlevels;
} skiplist_t;

PANDAS_INLINE double urand(void) {
static inline double urand(void) {
return ((double)rand() + 1) / ((double)RAND_MAX + 2);
}

PANDAS_INLINE int int_min(int a, int b) { return a < b ? a : b; }
static inline int int_min(int a, int b) { return a < b ? a : b; }

PANDAS_INLINE node_t *node_init(double value, int levels) {
static inline node_t *node_init(double value, int levels) {
node_t *result;
result = (node_t *)malloc(sizeof(node_t));
if (result) {
Expand All @@ -78,9 +77,9 @@ PANDAS_INLINE node_t *node_init(double value, int levels) {
}

// do this ourselves
PANDAS_INLINE void node_incref(node_t *node) { ++(node->ref_count); }
static inline void node_incref(node_t *node) { ++(node->ref_count); }

PANDAS_INLINE void node_decref(node_t *node) { --(node->ref_count); }
static inline void node_decref(node_t *node) { --(node->ref_count); }

static void node_destroy(node_t *node) {
int i;
Expand All @@ -100,7 +99,7 @@ static void node_destroy(node_t *node) {
}
}

PANDAS_INLINE void skiplist_destroy(skiplist_t *skp) {
static inline void skiplist_destroy(skiplist_t *skp) {
if (skp) {
node_destroy(skp->head);
free(skp->tmp_steps);
Expand All @@ -109,7 +108,7 @@ PANDAS_INLINE void skiplist_destroy(skiplist_t *skp) {
}
}

PANDAS_INLINE skiplist_t *skiplist_init(int expected_size) {
static inline skiplist_t *skiplist_init(int expected_size) {
skiplist_t *result;
node_t *NIL, *head;
int maxlevels, i;
Expand Down Expand Up @@ -147,7 +146,7 @@ PANDAS_INLINE skiplist_t *skiplist_init(int expected_size) {
}

// 1 if left < right, 0 if left == right, -1 if left > right
PANDAS_INLINE int _node_cmp(node_t *node, double value) {
static inline int _node_cmp(node_t *node, double value) {
if (node->is_nil || node->value > value) {
return -1;
} else if (node->value < value) {
Expand All @@ -157,7 +156,7 @@ PANDAS_INLINE int _node_cmp(node_t *node, double value) {
}
}

PANDAS_INLINE double skiplist_get(skiplist_t *skp, int i, int *ret) {
static inline double skiplist_get(skiplist_t *skp, int i, int *ret) {
node_t *node;
int level;

Expand All @@ -181,7 +180,7 @@ PANDAS_INLINE double skiplist_get(skiplist_t *skp, int i, int *ret) {

// Returns the lowest rank of all elements with value `value`, as opposed to the
// highest rank returned by `skiplist_insert`.
PANDAS_INLINE int skiplist_min_rank(skiplist_t *skp, double value) {
static inline int skiplist_min_rank(skiplist_t *skp, double value) {
node_t *node;
int level, rank = 0;

Expand All @@ -199,7 +198,7 @@ PANDAS_INLINE int skiplist_min_rank(skiplist_t *skp, double value) {
// Returns the rank of the inserted element. When there are duplicates,
// `rank` is the highest of the group, i.e. the 'max' method of
// https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.rank.html
PANDAS_INLINE int skiplist_insert(skiplist_t *skp, double value) {
static inline int skiplist_insert(skiplist_t *skp, double value) {
node_t *node, *prevnode, *newnode, *next_at_level;
int *steps_at_level;
int size, steps, level, rank = 0;
Expand Down Expand Up @@ -253,7 +252,7 @@ PANDAS_INLINE int skiplist_insert(skiplist_t *skp, double value) {
return rank + 1;
}

PANDAS_INLINE int skiplist_remove(skiplist_t *skp, double value) {
static inline int skiplist_remove(skiplist_t *skp, double value) {
int level, size;
node_t *node, *prevnode, *tmpnode, *next_at_level;
node_t **chain;
Expand Down
15 changes: 7 additions & 8 deletions pandas/_libs/include/pandas/vendored/klib/khash.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ int main() {

#define AC_VERSION_KHASH_H "0.2.6"

#include "pandas/inline_helper.h"
#include <limits.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -153,7 +152,7 @@ typedef khuint_t khiter_t;

// specializations of
// https://github.com/aappleby/smhasher/blob/master/src/MurmurHash2.cpp
khuint32_t PANDAS_INLINE murmur2_32to32(khuint32_t k) {
static inline khuint32_t murmur2_32to32(khuint32_t k) {
const khuint32_t SEED = 0xc70f6907UL;
// 'm' and 'r' are mixing constants generated offline.
// They're not really 'magic', they just happen to work well.
Expand Down Expand Up @@ -186,7 +185,7 @@ khuint32_t PANDAS_INLINE murmur2_32to32(khuint32_t k) {
// - no performance difference could be measured compared to a possible
// x64-version

khuint32_t PANDAS_INLINE murmur2_32_32to32(khuint32_t k1, khuint32_t k2) {
static inline khuint32_t murmur2_32_32to32(khuint32_t k1, khuint32_t k2) {
const khuint32_t SEED = 0xc70f6907UL;
// 'm' and 'r' are mixing constants generated offline.
// They're not really 'magic', they just happen to work well.
Expand Down Expand Up @@ -220,7 +219,7 @@ khuint32_t PANDAS_INLINE murmur2_32_32to32(khuint32_t k1, khuint32_t k2) {
return h;
}

khuint32_t PANDAS_INLINE murmur2_64to32(khuint64_t k) {
static inline khuint32_t murmur2_64to32(khuint64_t k) {
khuint32_t k1 = (khuint32_t)k;
khuint32_t k2 = (khuint32_t)(k >> 32);

Expand Down Expand Up @@ -445,7 +444,7 @@ static const double __ac_HASH_UPPER = 0.77;

#define KHASH_INIT(name, khkey_t, khval_t, kh_is_map, __hash_func, \
__hash_equal) \
KHASH_INIT2(name, PANDAS_INLINE, khkey_t, khval_t, kh_is_map, __hash_func, \
KHASH_INIT2(name, static inline, khkey_t, khval_t, kh_is_map, __hash_func, \
__hash_equal)

/* --- BEGIN OF HASH FUNCTIONS --- */
Expand All @@ -465,7 +464,7 @@ static const double __ac_HASH_UPPER = 0.77;
@param key The integer [khuint64_t]
@return The hash value [khuint_t]
*/
PANDAS_INLINE khuint_t kh_int64_hash_func(khuint64_t key) {
static inline khuint_t kh_int64_hash_func(khuint64_t key) {
return (khuint_t)((key) >> 33 ^ (key) ^ (key) << 11);
}
/*! @function
Expand All @@ -478,7 +477,7 @@ PANDAS_INLINE khuint_t kh_int64_hash_func(khuint64_t key) {
@param s Pointer to a null terminated string
@return The hash value
*/
PANDAS_INLINE khuint_t __ac_X31_hash_string(const char *s) {
static inline khuint_t __ac_X31_hash_string(const char *s) {
khuint_t h = *s;
if (h)
for (++s; *s; ++s)
Expand All @@ -496,7 +495,7 @@ PANDAS_INLINE khuint_t __ac_X31_hash_string(const char *s) {
*/
#define kh_str_hash_equal(a, b) (strcmp(a, b) == 0)

PANDAS_INLINE khuint_t __ac_Wang_hash(khuint_t key) {
static inline khuint_t __ac_Wang_hash(khuint_t key) {
key += ~(key << 15);
key ^= (key >> 10);
key += (key << 3);
Expand Down
Loading