caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Joerg Czeranski <jc@joerch.org>
To: ohl@hep.tu-darmstadt.de
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Re: complex bigarrays
Date: Thu, 8 Nov 2001 19:12:24 +0100 (CET)	[thread overview]
Message-ID: <200111081812.TAA37250@kiste.thiemo.net> (raw)
In-Reply-To: <15338.51001.121416.677202@heplix4.ikp.physik.tu-darmstadt.de>

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


  reply	other threads:[~2001-11-08 18:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-06  9:05 [Caml-list] Re: OCaml speed Rolf Wester
2001-11-06 10:44 ` Markus Mottl
2001-11-08  9:28 ` [Caml-list] Re: complex bigarrays Xavier Leroy
2001-11-08 14:59   ` Rolf Wester
2001-11-08 15:35   ` Thorsten Ohl
     [not found]     ` <81DA66D2-D46E-11D5-82F9-003065BDAA76@mac.com>
2001-11-08 17:56       ` Thorsten Ohl
2001-11-08 18:12         ` Joerg Czeranski [this message]
2001-11-08 18:20         ` Ken Rose
2001-11-08 18:35         ` David McClain
2001-11-08 23:13 David Gurr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200111081812.TAA37250@kiste.thiemo.net \
    --to=jc@joerch.org \
    --cc=caml-list@inria.fr \
    --cc=ohl@hep.tu-darmstadt.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).