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: 693069174 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> <8uoqi1$oqi$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: >> pragma Pack(bitfield); -- the following clause will not work >> -- without pragma >> for bitfield'Size use wordsize; > >As most certainly you would expect, see RM 13.3: > > 53 A Size clause on a composite subtype should not affect > the internal layout of components. Thanx. I noticed it some weeks before and missed to remove the comment. >followed by some gruesome code for doing a rotate, to which one must ask, >why on earth not use the Rotate functions provided as primitives in Ada 95 >(these can be located by looking up the keyword rotate in the index!) This piece of code is from my play and experimental grounds. I'd prefer a portable solution instead of mapping maschine code into a portability lib. Not all bit manipulation actions provided by the underlying CPU can be expeced to occur as compiler directives. This becomes especially true, if some complex manipulations has to be done. >Yes, I suppose GNAT (or in general any Ada 95 compiler) could try to >optimize this gruesome code, but since no one would ever write it anyway, >why bother? Because the generated code is even worse.