*BSD News Article 84134


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.cs.su.oz.au!metro!metro!munnari.OZ.AU!spool.mu.edu!uwm.edu!math.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!news.csuohio.edu!usenet
From: jabaker@grail.cba.csuohio.edu (jason)
Newsgroups: comp.unix.solaris,comp.unix.bsd.misc,comp.unix.internals
Subject: Re: Solaris 2.6
Date: 02 Dec 1996 19:17:33 -0500
Organization: Cleveland State University
Lines: 26
Sender: jason@jlbaker.async.csuohio.edu
Distribution: inet
Message-ID: <vviakfpls.fsf@jlbaker.async.csuohio.edu>
References: <32986299.AC7@mail.esrin.esa.it> <casper.329abb76@mail.fwi.uva.nl>
	<x7917mx5gx.fsf@dumbcat.codewright.com>
	<slrn59q566.3s2.dave@pc-damir.srce.hr>
Reply-To: jabaker@grail.cba.csuohio.edu
NNTP-Posting-Host: porta47.async.csuohio.edu
In-reply-to: dave@pc-damir.srce.hr's message of 28 Nov 1996 04:27:13 GMT
X-Newsreader: Gnus v5.0.13
Xref: euryale.cc.adfa.oz.au comp.unix.solaris:91183 comp.unix.bsd.misc:1657 comp.unix.internals:11424

In article <slrn59q566.3s2.dave@pc-damir.srce.hr> dave@pc-damir.srce.hr (Drazen Kacar) writes:

>>Stage 1:
>>Keep long 32 bits but now with 64 bit pointers so you can catch every
>>program that assumes a pointer can be stored in a long or int.

>How can I portably manipulate bits in pointers? Sometimes I need to
>find the page boundary, eg.

>char *p;

>p = (char *)((long)p & -getpagesize());

What is wrong with ptrdiff_t in place of long and size_t in place of
unsigned long?

>If long can't hold the pointer, I can change it to long long, but it
>will break on compilers that don't suport it.

>And sometimes I need to align the structure, eg.

>p = (struct foo *)(((long)p+sizeof(double)-1) & -sizeof(double));

>How should I do it?

Jason