diff options
author | Richard Braun <rbraun@sceen.net> | 2017-01-12 21:10:54 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-01-12 21:12:18 +0100 |
commit | bd875458fcb4aa5516996ffb128b601a89bd25af (patch) | |
tree | 3526e12306c00b0b5614719ee795d2a526539652 /avltree.h | |
parent | b4ea88ef4530f450ce2b44c2f09c510f2bea0f9b (diff) |
Replace unsigned long with uintptr_t for integer/pointer conversions
Diffstat (limited to 'avltree.h')
-rw-r--r-- | avltree.h | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Richard Braun. + * Copyright (c) 2010-2017 Richard Braun. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,6 +39,7 @@ #include <assert.h> #include <stddef.h> +#include <stdint.h> #include "macros.h" @@ -59,6 +60,11 @@ struct avltree_node; struct avltree; /* + * Insertion point identifier. + */ +typedef uintptr_t avltree_slot_t; + +/* * Static tree initializer. */ #define AVLTREE_INITIALIZER { NULL } @@ -84,7 +90,7 @@ avltree_node_init(struct avltree_node *node) { assert(avltree_node_check_alignment(node)); - node->parent = (unsigned long)node | AVLTREE_BALANCE_ZERO; + node->parent = (uintptr_t)node | AVLTREE_BALANCE_ZERO; node->children[AVLTREE_LEFT] = NULL; node->children[AVLTREE_RIGHT] = NULL; } @@ -218,8 +224,7 @@ MACRO_END * This macro essentially acts as avltree_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 avltree_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 * avltree_lookup(). @@ -258,7 +263,7 @@ MACRO_END * must denote a NULL node). */ static inline void -avltree_insert_slot(struct avltree *tree, unsigned long slot, +avltree_insert_slot(struct avltree *tree, avltree_slot_t slot, struct avltree_node *node) { struct avltree_node *parent; |