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-Thread: 103376,ddd2479bb7fae4af X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Mon, 07 Feb 2005 18:30:48 -0600 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <211db0ae.0502070437.54add641@posting.google.com> Subject: Re: Bit manipulation Date: Mon, 7 Feb 2005 18:32:36 -0600 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-mT9rcgRvVAVmbgkIlJ1my8vtLaR7S82zsOBRAfFSs8BeR/pHr0NMPNBRjVgeJ4CG7b1oAJ+EmQOuBZG!45YQpUyLoWS1vzfo2zYLOt8HCjoPXm7voUqEodeMT1q3AfqGR5lpTqbIyDeDgl+S4PeUxdduxjq8 X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.23 Xref: g2news1.google.com comp.lang.ada:8186 Date: 2005-02-07T18:32:36-06:00 List-Id: "Maurizio" wrote in message news:211db0ae.0502070437.54add641@posting.google.com... > hi, i need two hint: > > i need to acces to a 32 bit word (Interfaces.Unsigned_32). > how i can do to take the three m.s.bit? (30,31,32) > > second, i need to send the 32 bit word over a Tcp connection to a C > program, but > socket work with usigned 8 bit word, so i need to split the 32 bit in > 4 8bit word, > and when i read from the socket take 4 8bit word and combine in a 32 > word. > > i see that Ada.Unchecked_Conversion work (in an ada client/server test > program) but is correct? In both cases, I'd define an appropriate record type and use Unchecked_Conversion to convert it to a 32-bit word. I'll leave the details for someone else to explain. Randy.