Fix assumption that pointers fits in a 'long'
Windows uses LLP64 model so [u]intptr_t is more correct.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/rbtree.h b/rbtree.h
index 20306ff..7563725 100644
--- a/rbtree.h
+++ b/rbtree.h
@@ -95,10 +95,11 @@
#define _LINUX_RBTREE_H
#include <stdlib.h>
+#include <inttypes.h>
struct rb_node
{
- unsigned long rb_parent_color;
+ intptr_t rb_parent_color;
#define RB_RED 0
#define RB_BLACK 1
struct rb_node *rb_right;
@@ -121,7 +122,7 @@
static inline void rb_set_parent(struct rb_node *rb, struct rb_node *p)
{
- rb->rb_parent_color = (rb->rb_parent_color & 3) | (unsigned long)p;
+ rb->rb_parent_color = (rb->rb_parent_color & 3) | (uintptr_t)p;
}
static inline void rb_set_color(struct rb_node *rb, int color)
{
@@ -144,7 +145,7 @@
static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
struct rb_node ** rb_link)
{
- node->rb_parent_color = (unsigned long )parent;
+ node->rb_parent_color = (uintptr_t)parent;
node->rb_left = node->rb_right = NULL;
*rb_link = node;