From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8de933d44255f226 X-Google-Attributes: gid103376,public From: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson) Subject: Re: Q: unboxed values and polymorphism Date: 1996/07/02 Message-ID: <4rbgqf$t89@mulga.cs.mu.OZ.AU>#1/1 X-Deja-AN: 163303322 references: organization: Comp Sci, University of Melbourne newsgroups: comp.lang.ada Date: 1996-07-02T00:00:00+00:00 List-Id: dewar@cs.nyu.edu (Robert Dewar) writes: >Hannes said > >"Let's assume your fixnums have the low bits `00' as tags. To add >two fixnums, you would extract them from the word, perform the >usual addition and put the result in a variant record? I'd just >add the words." > >So what, you would get the same code! That's presuming the compiler is smart enough, which is a very big IF. Have you tried this with GNAT? I tried a simple example in C, and found that GNU C on an Alpha generated worse code using bitfields than using the approach suggested by Hannes above; in particular, it does not avoid the unnecessary shifts on the operands and result of the addition. I doubt if GNAT would do any better. (The test case I used is available on request, should anyone wish to duplicate the results of my experimentation.) -- Fergus Henderson | "I have always known that the pursuit WWW: | of excellence is a lethal habit" PGP: finger fjh@128.250.37.3 | -- the last words of T. S. Garp.