Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Dave Gilbert <gilbertd@treblig.org>
To: axp-list@redhat.com
Subject: Re: Writing portable Code for Glibc and 32/64 bit
Date: Sat, 21 Nov 1998 13:18:44 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.3.96.981121131554.513B-100000@tardis.home.dave> (raw)
In-Reply-To: <Pine.GSO.4.05.9811201348230.24296-100000@ursa.calvin.edu>

A portability problem I have tried to figure out a good soloution for is
that of structure sizes in arrays - e.g.

struct frob {
  void *a;
  void *b;
  int x;
  int dummy;
}

Now that isn't unreasonable is it? Size on 32 bit machine 16, size on
64 bit machine 24.
The problem is that say I made a big array out of those, and you want to
make sure that the compiler uses shift rather than multiply to address it.
This will happen on the 32 bit machine but not the 64 because of the
non-power of 2 size.

How does one write a structure of a mixture of pointers and ints etc while
guarenteeing it will be a power of 2 in size?

Dave

 --------------------------------------------------------------------   
/ Dr. David Alan Gilbert      | Running Linux on Alpha(LX) |  Happy  \ 
\   gro.gilbert @ treblig.org |   & ARM(EBSA285,old Arc)   |  In Hex /
 \____________________________|___ http://www.treblig.demon.co.uk __/


  reply	other threads:[~1998-11-21 13:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-20 11:03 Writing portable Code for Glibc and 32/64 bit y0000218
1998-11-20 15:02 ` Stefan Schroepfer
1998-11-20 18:53   ` Jeff DeMaagd
1998-11-21 13:18     ` Dave Gilbert [this message]
  -- strict thread matches above, loose matches on Subject: below --
1998-11-21 20:12 Greg Lindahl
1998-11-21 20:40 ` Dave Gilbert
1998-11-21 20:47   ` Maciej W. Rozycki
1998-11-21 20:51 Greg Lindahl
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox