All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael David Crawford <mdc@prgmr.com>
To: Michael David Crawford <mdc@prgmr.com>, xen-devel@lists.xensource.com
Subject: Re: Casting 64-bit pointers to integers
Date: Fri, 22 May 2009 02:53:38 -0700	[thread overview]
Message-ID: <4A167622.2070105@prgmr.com> (raw)
In-Reply-To: <20090522094141.GH10166@const.famille.thibault.fr>

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@prgmr.com

    prgmr.com - We Don't Assume You Are Stupid.

       Xen-Powered Virtual Private Servers: http://prgmr.com/xen

  reply	other threads:[~2009-05-22  9:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-22  9:30 Casting 64-bit pointers to integers Michael David Crawford
2009-05-22  9:41 ` Samuel Thibault
2009-05-22  9:53   ` Michael David Crawford [this message]
2009-05-22 10:01     ` Samuel Thibault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A167622.2070105@prgmr.com \
    --to=mdc@prgmr.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.