Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Re: OCaml speed
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Joerg Czeranski <jc@j...>
Subject: Re: [Caml-list] Re: complex bigarrays
On Thu, 8 Nov 2001 18:56:09 +0100
Thorsten Ohl <ohl@hep.tu-darmstadt.de> wrote:
> shiv@mac.com writes:
> > I have read (some where) that this might cause problems with some C
> > compilers on some machines. That is, if we define struct {float re;
> > float im} A[10]; Then the entries in A may not be packed together as
> > we might expect.
>
> AFAIK, the C compiler is free to pad structures for better alignment,
> resulting in better performance.  Isn't it even free to reorder
> elements?

No, it isn't.  Order must always be preserved, and no padding is allowed
in front of the first component.

You can always use an array of two elements for each complex:
float A[10][2];  (Or rather typedef float complex_t[2]; complex_t A[10];)
Then the compiler isn't allowed to use any padding.

C99 has introduced complex float, complex double, complex long double,
but I don't think there's a definition of the representation.

regards,
jörch
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr