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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2370fc34f084c855 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-08-02 17:53:18 PST Message-ID: <3D4B2968.7090108@hotmail.com> Date: Fri, 02 Aug 2002 19:52:56 -0500 From: Kevin Krieser User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada To: Mark Subject: Re: creating a 16 bit value from 2 8 bit values in Ada References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 12.44.141.235 X-Trace: corp.newsgroups.com 1028335031 12.44.141.235 (2 Aug 2002 19:37:11 -0500) X-Comments: This message was posted through Newsfeeds.com X-Comments2: IMPORTANT: Newsfeeds.com does not condone, nor support, spam or any illegal or copyrighted postings. X-Comments3: IMPORTANT: Under NO circumstances will postings containing illegal or copyrighted material through this service be tolerated!! X-Report: Please report illegal or inappropriate use to X-Abuse-Info: Please be sure to forward a copy of ALL headers, INCLUDING the body (DO NOT SEND ATTACHMENTS) Organization: Newsfeeds.com http://www.newsfeeds.com 80,000+ UNCENSORED Newsgroups. Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.berkeley.edu!news-hog.berkeley.edu!ucberkeley!nntp-relay.ihug.net!ihug.co.nz!news-out.newsfeeds.com!propagator2-maxim!propagator-maxim!news-in.spamkiller.net!feed.newsfeeds.com!corp.newsgroups.com!not-for-mail Xref: archiver1.google.com comp.lang.ada:27632 Date: 2002-08-02T19:52:56-05:00 List-Id: Mark wrote: > Could someone show me how to concatenate the Hi and Lo components? > The end result - obviously - would be a 16 bit value. I've waded > through my ada books here and keep coming up short? > > > type SOME_TYPE is > record > Lo : BYTE; > Hi : BYTE; > X : BOOLEAN; > -- more stuff > end record; > > for SOME_TYPE use > record > Lo at 0 range 0 .. 6; > Hi at 0 range 7 .. 15; > -- more stuff > end record; Sorry to be picky, but the above wouldn't work. Byte wouldn't fit in 7 bits. If you have some unsigned 16 bit type, called something like unsigned16, you could just do a big_val := unsigned16(hi) * 256 + unsigned16(lo); -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =-----