From e0dc28c59f32396c8389e2a9e4d147122cd857ab Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 01:46:00 -0500 Subject: [PATCH] librb: rb_dictionary: temporary hack to shut up gcc on windows --- librb/include/rb_dictionary.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/librb/include/rb_dictionary.h b/librb/include/rb_dictionary.h index 88774dd6f..002fcfba7 100644 --- a/librb/include/rb_dictionary.h +++ b/librb/include/rb_dictionary.h @@ -153,6 +153,8 @@ extern unsigned int rb_dictionary_size(struct Dictionary *dtree); void rb_dictionary_stats(struct Dictionary *dict, void (*cb)(const char *line, void *privdata), void *privdata); void rb_dictionary_stats_walk(void (*cb)(const char *line, void *privdata), void *privdata); +#ifndef _WIN32 + #define RB_POINTER_TO_INT(x) ((int32_t) (long) (x)) #define RB_INT_TO_POINTER(x) ((void *) (long) (int32_t) (x)) @@ -165,6 +167,22 @@ void rb_dictionary_stats_walk(void (*cb)(const char *line, void *privdata), void #define RB_POINTER_TO_ULONG(x) ((uint64_t) (unsigned long long) (x)) #define RB_ULONG_TO_POINTER(x) ((void *) (unsigned long long) (uint64_t) (x)) +#else + +#define RB_POINTER_TO_INT(x) ((int32_t) (unsigned long long) (x)) +#define RB_INT_TO_POINTER(x) ((void *) (unsigned long long) (int32_t) (x)) + +#define RB_POINTER_TO_UINT(x) ((uint32_t) (unsigned long long) (x)) +#define RB_UINT_TO_POINTER(x) ((void *) (unsigned long long) (uint32_t) (x)) + +#define RB_POINTER_TO_LONG(x) ((int64_t) (unsigned long long) (x)) +#define RB_LONG_TO_POINTER(x) ((void *) (unsigned long long) (int64_t) (x)) + +#define RB_POINTER_TO_ULONG(x) ((uint64_t) (unsigned long long) (x)) +#define RB_ULONG_TO_POINTER(x) ((void *) (unsigned long long) (uint64_t) (x)) + +#endif + static inline int rb_int32cmp(const void *a, const void *b) { return RB_POINTER_TO_INT(b) - RB_POINTER_TO_INT(a);