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=unavailable autolearn_force=no version=3.4.4 Path: border2.nntp.dca.giganews.com!nntp.giganews.com!goblin3!goblin.stu.neva.ru!rt.uk.eu.org!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!217.188.199.168.MISMATCH!takemy.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Mon, 23 Jun 2014 17:40:27 +0200 From: "G.B." User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Cleanest Ada way to do this? References: <7eaee5fc-2045-4bb3-8b16-d757b54760da@googlegroups.com> <6yHpv.55741$G37.7010@fx07.iad> <543afc17-4c32-4e15-a52f-80fcc1fbeaa6@googlegroups.com> <53a7d80b$0$6602$9b4e6d93@newsspool4.arcor-online.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <53a84a6a$0$6621$9b4e6d93@newsspool4.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 23 Jun 2014 17:40:26 CEST NNTP-Posting-Host: 1a3680a7.newsspool4.arcor-online.net X-Trace: DXC=C0ZDT>mhjI_Fm0Y?OE@2^X4IUKZLh>_cHTX3j]k4JE6Sjf7CV X-Complaints-To: usenet-abuse@arcor.de Xref: number.nntp.dca.giganews.com comp.lang.ada:187199 Date: 2014-06-23T17:40:26+02:00 List-Id: On 23.06.14 13:48, Simon Clubley wrote: > On 2014-06-23, Georg Bauhaus 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.