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 14:51:36 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!wn12feed!wn14feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!sccrnsc02.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Minimum Record Size? LONG References: X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc02 1051307495 12.234.13.56 (Fri, 25 Apr 2003 21:51:35 GMT) NNTP-Posting-Date: Fri, 25 Apr 2003 21:51:35 GMT Organization: AT&T Broadband Date: Fri, 25 Apr 2003 21:51:35 GMT Xref: archiver1.google.com comp.lang.ada:36576 Date: 2003-04-25T21:51:35+00:00 List-Id: >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 >> -- assemble them into one segment >> Segment := (Shift_Left(Part_1, 18) and 16#fc0000#) or >> (Shift_Left(Part_2, 12) and 16#03f000#) or >> (Shift_Left(Part_3, 6) and 16#000fc0#) or >> (Shift_left(Part_4, 0) and 16#00003f#) ; >> >> -- split segment into three eight-bit hunks >> Val_1 := (Shift_Right(Segment and 16#ff0000#, 16)); >> Val_2 := (Shift_Right(Segment and 16#00ff00#, 8)); >> Val_3 := (Shift_Right(Segment and 16#0000ff#, 0)); 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;