comp.lang.ada
 help / color / mirror / Atom feed
From: "G.B." <rm-dash-bau-haus@dash.futureapps.de>
Subject: Re: Cleanest Ada way to do this?
Date: Mon, 23 Jun 2014 17:40:27 +0200
Date: 2014-06-23T17:40:26+02:00	[thread overview]
Message-ID: <53a84a6a$0$6621$9b4e6d93@newsspool4.arcor-online.net> (raw)
In-Reply-To: <lo946m$5lm$1@dont-email.me>

On 23.06.14 13:48, Simon Clubley wrote:
> On 2014-06-23, Georg Bauhaus <rm-host.bauhaus@maps.futureapps.de> wrote:
>> On 23/06/14 08:46, hungupharps@gmail.com wrote:
>>> I've got a bitfield representing the LCD data lines and I'm trying then to write bits from a Character into it.
>>
>> If you know the size of the Character, 8 say, unchecked_conversion
>> seems possible, the target type being any 8-bit type that works,
>> e.g. a packed array of bits, or an Unsigned_8. The first offering
>> slices, the second providing for shifts and masks.
>>
>
> Wouldn't a better approach be to start with Character'Pos instead of a
> Unchecked_Conversion ?

Yes, if it is sufficient to use shifts and masks. The instructions
generated seem identical, at least when using GNAT on Intel.



  reply	other threads:[~2014-06-23 15:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-22 16:51 Cleanest Ada way to do this? Mike Silva
2014-06-22 19:07 ` Simon Clubley
2014-06-22 21:20   ` Mike Silva
2014-06-22 21:05 ` Shark8
2014-06-23  0:17   ` Simon Clubley
2014-06-23  6:46     ` hungupharps
2014-06-23  7:32       ` Georg Bauhaus
2014-06-23 11:48         ` Simon Clubley
2014-06-23 15:40           ` G.B. [this message]
2014-06-23  9:02 ` rrr.eee.27
2014-06-23 11:57   ` Simon Clubley
2014-06-23 12:05     ` rrr.eee.27
replies disabled

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