comp.lang.ada
 help / color / mirror / Atom feed
From: Dennis Hoppe <dennis.hoppe@hoppinet.de>
Subject: Re: Bit operations in Ada (Thank you)
Date: Sat, 24 May 2008 11:40:17 +0200
Date: 2008-05-24T11:40:17+02:00	[thread overview]
Message-ID: <g18nq1$39m$1@aioe.org> (raw)
In-Reply-To: 

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



  parent reply	other threads:[~2008-05-24  9:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-23 21:19 Bit operations in Ada Dennis Hoppe
2008-05-23 22:08 ` Ludovic Brenta
2008-05-24 15:36   ` Simon Wright
2008-06-02 13:27     ` Bit operations in Ada (endianness) Dennis Hoppe
2008-06-02 14:01       ` (see below)
2008-06-02 18:22         ` Jeffrey R. Carter
2008-06-02 17:38       ` Ludovic Brenta
2008-05-23 22:38 ` Bit operations in Ada Robert A Duff
2008-05-24  0:27   ` Randy Brukardt
2008-05-24  9:40   ` Dennis Hoppe [this message]
2008-05-23 23:25 ` Jeffrey R. Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox