From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 0AA00BC88 for ; Tue, 8 Feb 2005 16:30:23 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j18FUM2M001806 for ; Tue, 8 Feb 2005 16:30:22 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA27302 for ; Tue, 8 Feb 2005 16:30:22 +0100 (MET) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j18FUKHu001797 for ; Tue, 8 Feb 2005 16:30:21 +0100 Received: from [192.168.1.200] (ppp212-197.lns2.syd3.internode.on.net [203.122.212.197]) by smtp1.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id j18FU684025851; Wed, 9 Feb 2005 02:00:18 +1030 (CST) Subject: Re: AW: [Caml-list] paralell assignment problem From: skaller Reply-To: skaller@users.sourceforge.net To: "Beck01, Wolfgang" Cc: caml-list In-Reply-To: <76C27E1CE3FFC847B4D51C645D6F42AA15FE3B@E9JDF.mgb01.telekom.de> References: <76C27E1CE3FFC847B4D51C645D6F42AA15FE3B@E9JDF.mgb01.telekom.de> Content-Type: text/plain Message-Id: <1107876604.5022.44.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 09 Feb 2005 02:30:05 +1100 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 4208DB0E.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4208DB0C.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 sourceforge:01 wrote:01 rhs:01 rhs:01 glebe:01 061:98 arbitrary:01 arbitrary:01 expression:01 nsw:01 snail:02 2037:02 variables:02 wolfgang:02 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: 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