*BSD News Article 55077


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!yarrina.connect.com.au!munnari.OZ.AU!news.hawaii.edu!ames!usenet.kornet.nm.kr!news.kreonet.re.kr!usenet.seri.re.kr!news.imnet.ad.jp!lab!wsclark!hu-eos-news!hiroshi
From: hiroshi@teine.chem2.hokudai.ac.jp (Hiroshi Murakami)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Aligned or not aligned that is the problem.
Date: 19 Nov 1995 00:47:26 GMT
Organization: Hokkaido Univ., Sapporo, Japan.
Lines: 30
Message-ID: <48luqu$c2f@nyx.eos.hokudai.ac.jp>
NNTP-Posting-Host: teine.chem2.hokudai.ac.jp

I wish to know how the double 8 byte data will be allocated
for different installation of versions of FreeBSS with the
combination of the versions of gccs.  Let try to compile the
following sample source code

	% gcc -v  a.c

And run it to show if the double variable is out of
8 byte aligned or not. For pentium, it seems every load/store/fp-operation
of double data about twice slower than the 8 byte aligned case.
When you wish upon the Pentium so that your computation will be fast
than not just come true, you must align you double or you waste your
machine.


/*-----------------------*/
double a[100];
static double b[100];

main()
{
double c[100];
int i;
double d[100];

	printf("Octal address: a:%o, b:%o, c:%o, d:%o\n",
		(unsigned)a,(unsigned)b,(unsigned)c,(unsigned)d);
}
/*-----------------------*/