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,91e38895ea853f4b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-26 17:06:31 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!crtntx1-snh1.gtei.net!lsanca1-snf1!news.gtei.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3BD9FA80.C4B08A5E@acm.org> From: Jeffrey Carter X-Mailer: Mozilla 4.7 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Query on portable bit extraction References: <3BD99406.62B13405@Raytheon.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sat, 27 Oct 2001 00:06:31 GMT NNTP-Posting-Host: 63.180.2.44 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 1004141191 63.180.2.44 (Fri, 26 Oct 2001 17:06:31 PDT) NNTP-Posting-Date: Fri, 26 Oct 2001 17:06:31 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net X-Received-Date: Fri, 26 Oct 2001 17:02:40 PDT (newsmaster1.prod.itd.earthlink.net) Xref: archiver1.google.com comp.lang.ada:15291 Date: 2001-10-27T00:06:31+00:00 List-Id: I would recommend using a collection of bytes and ensuring that the same bytes contain the same values on all platforms. Then extract the desired parts of the desired bytes, combining them as required. You can also, if you're sure the same bytes have the same values, combine bytes into larger values using type conversions and shifts or multiplications: T1 := Shift_Left (Unsigned_16 (Byte_21), 8) or Unsigned_16 (Byte_22); T2 := Shift_Right (T1, 6) and 2#0111_1111#; -- YYY_YYYY Both work correctly regardless of endianness; -- Jeff Carter "I wave my private parts at your aunties." Monty Python & the Holy Grail