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: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Clubley Newsgroups: comp.lang.ada Subject: Re: Cleanest Ada way to do this? Date: Mon, 23 Jun 2014 11:48:38 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: 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> Injection-Date: Mon, 23 Jun 2014 11:48:38 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="e458ff8b81bc0c159989eb0e36c6e372"; logging-data="5814"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/NtcHhER01eK5ZMOdDWpTcJKPChLd3bzQ=" User-Agent: slrn/0.9.8.1 (VMS/Multinet) Cancel-Lock: sha1:O4JYNFsh7cktnzi16RVlje2+Z5c= Xref: news.eternal-september.org comp.lang.ada:20553 Date: 2014-06-23T11:48:38+00:00 List-Id: 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 ? I'm genuinely curious. I'm wondering if there's something I am missing. Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world