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,705f377a5e04a446 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!aioe.org!not-for-mail From: Dennis Hoppe Newsgroups: comp.lang.ada Subject: Re: Bit operations in Ada (Thank you) Date: Sat, 24 May 2008 11:40:17 +0200 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: Om1uwsVUubh9+8oIJAkutw.user.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org In-Reply-To: User-Agent: Thunderbird 3.0a1 (Macintosh/2008050714) Xref: g2news1.google.com comp.lang.ada:320 Date: 2008-05-24T11:40:17+02:00 List-Id: Robert A Duff wrote: > I'm curious why you want to do all these things on the same type. > You say, "My objective is...", but what's the higher-level objective? The higher-level objective is to get involved in cryptoanalysis. > Anyway, I would use Unchecked_Conversion between a modular type and a > packed array of Boolean, as suggested by Ludovic Brenta. > Possibly wrapped in useful functions. > > Instead of pragma Pack, I would use > "for Bit_Field'Component_Size use 1;". > They both do the same thing, but conceptually, "pack" means > "I want small things, so whole-object operations are faster, > at the expense of per-component operations", whereas the > Component_Size clause means "I depend on the exact bit size > for correctness". > > - Bob Many thanks for your detailed explanation of possible solutions, Ludovic. I would like to also thank the "rest of the group". I stumbled upon Ada.Unchecked_Conversion, but wasn't sure, if this is the way to enforce some behaviour in Ada. I guess, I wil give this solution a try and replace the pack pragma with your approach, Bob. Best regards, Dennis