caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: "Beck01, Wolfgang" <BeckW@t-systems.com>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: AW: [Caml-list] paralell assignment problem
Date: 09 Feb 2005 02:30:05 +1100	[thread overview]
Message-ID: <1107876604.5022.44.camel@pelican.wigram> (raw)
In-Reply-To: <76C27E1CE3FFC847B4D51C645D6F42AA15FE3B@E9JDF.mgb01.telekom.de>

On Wed, 2005-02-09 at 01:24, Beck01, Wolfgang wrote:

> > I seek a solution which minimises the number of assignments. 
[]
> you probably know the 'xor trick' to swap value without a temporary:

I've heard of it :)

> Certainly not what you were looking for, but always nice :-)

You are right, it isn't useful here for three reasons:

(1) the values being assigned aren't necessarily bitwise
  copyable, in fact they're (more or less) arbitrary C++ values

(2) The intent is to reduce time not storage

(3) The RHS can be arbitrary expressions. To apply XOR,
we'd first assign each RHS expression to a temporary ..
and having done that we no longer need XOR, we can just
assign variables to those temporaries.

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net




      reply	other threads:[~2005-02-08 15:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-08 14:24 Beck01, Wolfgang
2005-02-08 15:30 ` skaller [this message]

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=1107876604.5022.44.camel@pelican.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=BeckW@t-systems.com \
    --cc=caml-list@inria.fr \
    /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).