rb_dictionary: add functions for uint64_t (long) variables.

This commit is contained in:
Elizabeth Myers 2016-03-13 00:16:19 -06:00
parent 0e1f366732
commit b22c6f101c

View file

@ -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