Subject: Re: PTRTOINT64() / INT64TOPTR()
To: Klaus Klein <kleink@reziprozitaet.de>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 02/18/2004 10:36:41
--DocE+STaALJfprDB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Feb 18, 2004 at 01:11:16PM +0100, Klaus Klein wrote:
> On Tuesday 17 February 2004 23:31, Daniel Carosone wrote:
> > On Wed, Feb 18, 2004 at 09:17:58AM +1100, Simon Burge wrote:
> > > I wonder if <sys/sysctl.h> is the right place - the macro isn't
> > > sysctl-specific.  That said, I'm not sure where else.  <sys/param.h>
> > > seems like overkill.
> >
> > types.h or one of the inttypes variants under it?
>=20
> I'd prefer having it not appear in the standard headers.  First,
> there's the namespace issue.   Second, C99 doesn't really say

We can add it in a NetBSD Source ifdef

> that you can convert between pointers and uint64_t (note that
> the current implementation is using u_int64_t, and PTRTOUINT64()
> would be a slightly less confusing name); that's why there's
> uintptr_t, after all.

I'm not sure why we use uint64_t. It could predate uintptr_t. What does=20
cvs blame say?

As a side issue, I'd expect that if we add a UINT64TOPTR(), we only need=20
to define it such that given void *p; p =3D=3D UINT64TOPTR(PTRTOUINT64(p)) =
.=20
i.e. it only needs to invert PTRTOUINT64().

Another issue might be to instead define UN_PTRTOUINT64(). :-)

Take care,

Bill

--DocE+STaALJfprDB
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iD8DBQFAM7C5Wz+3JHUci9cRAsufAJwJUsANUQLF6PLqCFKzrsZGjXn/AwCeNnxW
NbAMMK7FhKyyF9OySpEtnHM=
=RTYA
-----END PGP SIGNATURE-----

--DocE+STaALJfprDB--