 
	
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] libxc: Casting of xen virtual address type xen_vaddr_t to signed int64 type: (int64_t)vaddr
 Hi All,
While looking at code in tools/libxc/xc_sr_save_x86_pv.c,
we see that there is casting of xen virtual address type xen_vaddr_t
to signed int64 type.
In commit: 7bf74582b343603cb0826d808cd7da43326452a5
+/* Check a 64 bit virtual address for being canonical. */
+static inline bool is_canonical_address(xen_vaddr_t vaddr)
+{
+    return ((int64_t)vaddr >> 47) == ((int64_t)vaddr >> 63);
+}
It seems there is no need to cast vaddr variable. It looks like
shifting vaddr signed 64-bit value by 63 bits introduces undefined
behavior. Could you please describe what is the reason for this
casting?
Thanks
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
 
 | 
|  | Lists.xenproject.org is hosted with RackSpace, monitoring our |