Simplify and build-fix (for some gcc versions) radix_tree_int_to_ptr().

Signed-off-by: Keir Fraser <keir@xen.org>
This commit is contained in:
Keir Fraser committed 2011-05-11 12:58:04 +01:00
1 parent aef3f22758
commit b004883e29
1 file changed
+3 -2
+3 -2
View File
@@ -181,8 +181,9 @@ static inline void radix_tree_replace_slot(void **pslot, void *item)
*/
static inline void *radix_tree_int_to_ptr(int val)
{
ASSERT((val <= (LONG_MAX >> 2)) && (val >= (LONG_MIN >> 2)));
return (void *)(((long)val << 2) | 0x2ul);
long _ptr = ((long)val << 2) | 0x2l;
ASSERT((_ptr >> 2) == val);
return (void *)_ptr;
}
static inline int radix_tree_ptr_to_int(void *ptr)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.