From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA04719; Wed, 7 Jul 2004 15:22:42 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA04416 for ; Wed, 7 Jul 2004 15:22:41 +0200 (MET DST) Received: from relay-5v.club-internet.fr (relay-5v.club-internet.fr [194.158.96.110]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i67DMeSH015602 for ; Wed, 7 Jul 2004 15:22:40 +0200 Received: from homer (l04m-6-149.d1.club-internet.fr [62.34.31.149]) by relay-5v.club-internet.fr (Postfix) with ESMTP id 128A91681 for ; Wed, 7 Jul 2004 15:22:39 +0200 (CEST) Received: from /spool/local by homer with [XMail 1.17 (Linux/Ix86) LMAIL Server] for from <>; Wed, 7 Jul 2004 15:22:39 +0200 Date: Wed, 7 Jul 2004 15:22:38 +0200 From: David Haguenauer To: caml-list@inria.fr Subject: Re: [Caml-list] Does Caml have slow arithmetics ? Message-ID: <20040707132237.GA26766@homer> Mail-Followup-To: caml-list@inria.fr References: <20040707091308.GA26172@bourg.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Face: "U|aI!fP/Fv%x4ZG?9}!@G9,zz2[9bhDBrYE&nIEL8N't?f0Q8~X?F@(:VV $WpE`T5bPj,/cC]/p&<{]8qLfir]9b^: ?y4iE17oEY47F&z6E3dUXq}eHy&]yGq?A X-Penguin: 2.4.21-hmr-b User-Agent: Mutt/1.5.6i X-Miltered: at concorde with ID 40EBF920.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 arithmetics:01 2004:99 pons:01 subsidiary:99 silently:01 leroy's:01 unboxed:01 pointers:01 aligned:01 publi:01 fernandez:01 tagged:01 -bit:01 -bit:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On 2004-07-07 14:32:56 Wed, Diego Olivier Fernandez Pons wrote: > > In principle yes, because int values are represented as tagged > > (31bits) ints (with the LSB set to 1). So conversion is a shift > > followed by an addition (or viceversa). > > Subsidiary question : why LSB instead of MSB ? I thought it would be > simpler to let the computations silently overflow and correct when > necessary the tag bit. Xavier Leroy's report about the ZINC experiment gives a good rationale: 4.2.1 Unallocated objects The only kind of unallocated (unboxed) objects is small integers. As the heap contains only 32-bit words, all pointers in the heap are 32-bit aligned, so their low-order bits are always 00. Integers are therefore encoded with a 1 as low-order bit: [...] (http://pauillac.inria.fr/~xleroy/publi/ZINC.ps.gz) -- David Haguenauer ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners