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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8309f2bc055237c4 X-Google-Attributes: gid103376,public From: lutz@iks-jena.de (Lutz Donnerhacke) Subject: Re: Bit manipulation Date: 2000/11/13 Message-ID: #1/1 X-Deja-AN: 693069187 Distribution: world Content-Transfer-Encoding: 8bit References: <8u8v6n$b7o$1@nnrp1.deja.com> <2WTH$pdrCfOd@eisner.decus.org> <8ub6kt$6nd$1@nnrp1.deja.com> <8ubeq8$cgm$1@nnrp1.deja.com> <3A0D38E9.BB87D8CD@mindspring.com> <8uoq5g$of6$1@nnrp1.deja.com> Content-Type: text/plain; charset=ISO-8859-1 Organization: IKS GmbH Jena Mime-Version: 1.0 User-Agent: slrn/0.9.5.7 (UNIX) Newsgroups: comp.lang.ada Date: 2000-11-13T00:00:00+00:00 List-Id: * Robert Dewar wrote: > lutz@iks-jena.de (Lutz Donnerhacke) wrote: >> for lowrec'Bit_Order use Low_Order_First; >> for highrec'Bit_Order use High_Order_First; >> >> function l2h is new Ada.Unchecked_Conversion (lowrec, highrec); >No, this is completely wrong. Once again, it is *really* a good >idea to actually try out something before posting it here. GNAT can not compile it. Bit_Order can not be set. >Bit_Order confuses many people, since certainly it *sounds* >as though it might do what you expected, but most certainly >it does *not* do anything of the kind. Very bad. I would offer a perfect way to use the representation clauses for real world applications. But so they are nearly senseless. >In fact the solution above is doubly wrong, because the use of unchecked >conversion ensures that nothing actually happens at all! Sure? The return statment (with was wrong, because .data was forgotten) would generate a endianess prefix on reading the memory location. This does the whole thing. (Using Alpha, Ia64, ...) >In any case, read the GNAT documentation to understand what the real >situation here is. The operable sentence from the GNAT Reference Manual is > > In the case where the non-standard value is specified, the > effect is to renumber bits within each bit, but the ordering > of bytes is not affected. > >let alone ordering of bits!!!! We talk about bit ordering.