[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Simplify and build-fix (for some gcc versions) radix_tree_int_to_ptr().



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1305115084 -3600
# Node ID 0c446850d85e654dfde039a0a1a5acd4e6b3c278
# Parent  19452acd23045f40c4e18437f0a60f016757e5bd
Simplify and build-fix (for some gcc versions) radix_tree_int_to_ptr().

Signed-off-by: Keir Fraser <keir@xxxxxxx>
---


diff -r 19452acd2304 -r 0c446850d85e xen/include/xen/radix-tree.h
--- a/xen/include/xen/radix-tree.h      Fri May 06 11:15:35 2011 +0100
+++ b/xen/include/xen/radix-tree.h      Wed May 11 12:58:04 2011 +0100
@@ -181,8 +181,9 @@
  */
 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)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.