diff --git a/librb/include/rb_dictionary.h b/librb/include/rb_dictionary.h index 2ae5b7256..d2eb2c633 100644 --- a/librb/include/rb_dictionary.h +++ b/librb/include/rb_dictionary.h @@ -157,6 +157,12 @@ void rb_dictionary_stats_walk(void (*cb)(const char *line, void *privdata), void #define RB_POINTER_TO_UINT(x) ((uint32_t) (unsigned long) (x)) #define RB_UINT_TO_POINTER(x) ((void *) (unsigned 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)) + static inline int rb_int32cmp(const void *a, const void *b) { return RB_POINTER_TO_INT(b) - RB_POINTER_TO_INT(a); @@ -167,4 +173,14 @@ static inline int rb_uint32cmp(const void *a, const void *b) return RB_POINTER_TO_UINT(b) - RB_POINTER_TO_UINT(a); } +static inline int rb_int64cmp(const void *a, const void *b) +{ + return RB_POINTER_TO_LONG(b) - RB_POINTER_TO_LONG(a); +} + +static inline int rb_uint64cmp(const void *a, const void *b) +{ + return RB_POINER_TO_ULONG(b) - RB_POINTER_TO_ULONG(a); +} + #endif