|  |  | 
  
    |  |  | 
 
  |   |  | 
  
    |  |  | 
  
    |  |  | 
  
    |   xen-devel
Re: [Xen-devel] Casting 64-bit pointers to integers 
| 
Samuel Thibault wrote:
 
intptr_t/uintptr_t is there for this.
 
In tools/xenpmd/acpi-events.c, which is in the git sources but doesn't 
seem to be in the 3.4 sources, there are two returns from 
acpi_events_thread which cast ints to void*'s.  These break the compile 
on 64-bit. 
One of the ints is a socket_fd, the other is the result from a connect 
system call. 
I got it to compile at first by doing something like this:
  return (void*)(unsigned long long)socket_fd
But what would be better is
  return (void*)(uintptr_t)socket_fd
If you were to just make socket_fd a uintptr_t, it would lose precision 
when you passed it to connect.  You could explicitly cast it to an int 
there, I suppose. 
Mike
--
Michael David Crawford
mdc@xxxxxxxxx
   prgmr.com - We Don't Assume You Are Stupid.
      Xen-Powered Virtual Private Servers: http://prgmr.com/xen
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
 | 
 |  | 
  
    |  |  |