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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ca7e14ee1b312f90 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-25 20:00:06 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!postnews1.google.com!not-for-mail From: david.c.hoos.sr@ada95.com (David C. Hoos) Newsgroups: comp.lang.ada Subject: Re: Minimum Record Size? LONG Date: 25 Apr 2003 20:00:05 -0700 Organization: http://groups.google.com/ Message-ID: References: NNTP-Posting-Host: 68.159.146.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1051326006 27103 127.0.0.1 (26 Apr 2003 03:00:06 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 26 Apr 2003 03:00:06 GMT Xref: archiver1.google.com comp.lang.ada:36586 Date: 2003-04-26T03:00:06+00:00 List-Id: wrote in message news:H5iqa.621548$L1.175962@sccrnsc02... > >Here is an approach that, while verbose, is written to be understandable > >by the reader. > If the reader is careful and willing to study a shorter piece of code, > then, in the spirit of the OP's first try > we can modify the function to: > > function Four_Sixes_To_Three_Eights (X : Four_Sixes) > > return Three_Eights > > is > > begin > return (1=> Eight(x(1))*4 + Eight(x(2))/16, > 2=> (Eight(x(2)) mod 16)*16 + Eight(x(3))/4, > 3=> (Eight(x(3)) mod 4)*64 + Eight(x(4))); > > end Four_Sixes_To_Three_Eights; Very nice. I overlooked the fact that arithmetic operations instead of shifts and masks would take care of the endianness problem in a very elegant way.