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-Thread: 103376,9dec3ff1604723d9 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!newsfeed.stueberl.de!uucp.gnuu.de!newsfeed.arcor.de!news.arcor.de!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Bitmanipulation in Ada From: Bernd.Specht@gmx.com (Bernd Specht) References: <87k6vwrwym.fsf@insalien.org> Organization: No company Message-ID: User-Agent: Xnews/4.05.03 Date: 19 Aug 2004 17:30:17 GMT NNTP-Posting-Date: 19 Aug 2004 19:30:17 MEST NNTP-Posting-Host: cde0620f.newsread4.arcor-online.net X-Trace: DXC=SLFV]ZYi05IJ2=Pn8=T1[J:ejgIfPPldDjW\KbG]kaMHlSE5DYV?adAVoN=S]ccfiGWEh14DWb8DHhoe1_24QkCMc3j0kIhaR2I X-Complaints-To: abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:2861 Date: 2004-08-19T19:30:17+02:00 List-Id: "Ed Falis" wrote in news:opscx5geap5afhvo@localhost: > On 18 Aug 2004 21:10:30 GMT, Bernd Specht wrote: > >> OK, but this would result in an assignment operation (a memory move on >> maschine code level). What I want is a real "overlay" (same storage >> location used for both), so reading the value would not need extra >> instructions. > > In all implementations of which I'm aware (and I've been in the Ada > compiler business for over 20 years) no code would be generated for an > unchecked conversion where the source and target have the same size. Sorry, but that's absolutely *nonsense* Have a look at Ludovics code: with Ada.Unchecked_Conversion; procedure P is type Byte_Array is array (1 .. Integer'Size) of Boolean; pragma Pack (Byte_Array); for Byte_Array'Size use Integer'Size; function To_Byte_Array is new Ada.Unchecked_Conversion (Source => Integer, Target => Byte_Array); I : Integer := 42; B : Byte_Array := To_Byte_Array (I); begin null; end P; You agree that "I" and "B" are located at different adresses? Do you *really* think that you need *no* code to move data from one address to another??? That's wrong! You need at least *one* instruction, and this can be time consuming - especially if the data is missaligned and/or the code runs in a multiprocessor environment. > You sound like you're looking for things to complain about, by the way. Sorry - but you seem to be a blatherer. > (and I've been in the Ada compiler business for over 20 years) Wow! Be happy. > > - Ed *plonk*