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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:ad4:4810:: with SMTP id g16mr16143927qvy.22.1579450264492; Sun, 19 Jan 2020 08:11:04 -0800 (PST) X-Received: by 2002:aca:490e:: with SMTP id w14mr10094335oia.67.1579450264180; Sun, 19 Jan 2020 08:11:04 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!g89no1264273qtd.0!news-out.google.com!o19ni210qtr.1!nntp.google.com!g89no1264262qtd.0!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 19 Jan 2020 08:11:03 -0800 (PST) In-Reply-To: <516be7e3-4be3-4697-adb0-9fbde4d5b7e6@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=47.185.239.228; posting-account=zwxLlwoAAAChLBU7oraRzNDnqQYkYbpo NNTP-Posting-Host: 47.185.239.228 References: <4b0649b3-aed2-44fd-822f-d6665b9352dd@googlegroups.com> <536e9961-f454-44d9-95a6-aecaaee1addf@googlegroups.com> <516be7e3-4be3-4697-adb0-9fbde4d5b7e6@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <81a31f56-d59d-4133-822d-c0239fd352e8@googlegroups.com> Subject: Re: Creating several types from a base type and conversion From: Optikos Injection-Date: Sun, 19 Jan 2020 16:11:04 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:57899 Date: 2020-01-19T08:11:03-08:00 List-Id: On Sunday, January 19, 2020 at 5:48:20 AM UTC-6, AdaMagica wrote: > Am Sonntag, 19. Januar 2020 10:37:21 UTC+1 schrieb Simon Wright: > > representation clauses where endianness is involved are a lot more > > confusing than shifts and masks. >=20 > See https://en.wikibooks.org/wiki/Ada_Programming/Attributes/%27Bit_Order >=20 > This is a complete description of how far we can get with endian independ= ence in current Ada. Ada 202x won't change anything in this respect. >=20 > CKWG No, it is not entirely complete=E2=80=94not entirely capturing the full ind= ustrial practice on this little-endian/big-endian topic. A complete treatm= ent of the topic would include utilizing the build system to swap in either= of 2 child packages containing same-named identifiers, such as my aforemen= tioned {ExtractCharWordFromDataWord, EmbedCharWordIntoDataWord, ExtractData= WordFromInstructionWordOpcode, EmbedDataWordIntoInstructionWordOpcode, Extr= actDataWordFromInstructionWordImmediate, EmbedDataWordIntoInstructionWordIm= mediate, ExtractDataWordFromImmediateForSuchandsuchOpcode, EmbedDataWordIn= toImmediateForSuchandsuchOpcode} where 1) one child package has the =E2=80=A2little-endian=E2=80=A2 shifting & mas= king (via either declarative/representation-clauses or bit-twiddling impera= tive/OR-&-AND-expressions-&-assignments) variant for each of those identifi= er names and 2) the other child package has the =E2=80=A2big-endian=E2=80=A2 shifting & = masking (=E2=80=A6) variant for each of those identifier names. Yes, I realize that the build system is (unfortunately!) not standardized i= n Ada, but (nearly?) all Ada compilers since time began have permitted some= technique of choosing which packages to include or exclude from the build = so that the linker choses this variant or that variant of same-named identi= fiers to actually be linked into the executable or dynamically-linked libra= ry, preferably on a per-ISA basis or on a conditional-compilation basis.