diff options
author | Richard Braun <rbraun@sceen.net> | 2017-01-13 00:16:09 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-01-13 00:16:09 +0100 |
commit | cf59c5fa63b4639777fbe28fba79cfbd63fa6d4e (patch) | |
tree | 6cd4b64fc94f7cc9c2c1f75ba298169a88248657 /kern/rbtree.h | |
parent | 27e9a04a0a07707d7a85dc65198b4ab8f32888f6 (diff) |
Replace unsigned long with uintptr_t for integer/pointer conversions
This is mostly done for the machine-independent part.
Diffstat (limited to 'kern/rbtree.h')
-rw-r--r-- | kern/rbtree.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/kern/rbtree.h b/kern/rbtree.h index 0e552b44..dd17e956 100644 --- a/kern/rbtree.h +++ b/kern/rbtree.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, 2012 Richard Braun. + * Copyright (c) 2010-2017 Richard Braun. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +24,7 @@ #include <kern/assert.h> #include <kern/macros.h> #include <kern/stddef.h> +#include <kern/stdint.h> /* * Indexes of the left and right nodes in the children array of a node. @@ -41,6 +42,11 @@ struct rbtree_node; */ struct rbtree; +/* + * Insertion point identifier. + */ +typedef uintptr_t rbtree_slot_t; + #include <kern/rbtree_i.h> /* @@ -62,7 +68,7 @@ rbtree_node_init(struct rbtree_node *node) { assert(rbtree_node_check_alignment(node)); - node->parent = (unsigned long)node | RBTREE_COLOR_RED; + node->parent = (uintptr_t)node | RBTREE_COLOR_RED; node->children[RBTREE_LEFT] = NULL; node->children[RBTREE_RIGHT] = NULL; } @@ -200,8 +206,7 @@ MACRO_END * This macro essentially acts as rbtree_lookup() but in addition to a node, * it also returns a slot, which identifies an insertion point in the tree. * If the returned node is null, the slot can be used by rbtree_insert_slot() - * to insert without the overhead of an additional lookup. The slot is a - * simple unsigned long integer. + * to insert without the overhead of an additional lookup. * * The constraints that apply to the key parameter are the same as for * rbtree_lookup(). @@ -240,7 +245,7 @@ MACRO_END * must denote a null node). */ static inline void -rbtree_insert_slot(struct rbtree *tree, unsigned long slot, +rbtree_insert_slot(struct rbtree *tree, rbtree_slot_t slot, struct rbtree_node *node) { struct rbtree_node *parent; |