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!feeder.eternal-september.org!aioe.org!.POSTED.Oh2LSLzxQ4+YU0Htrufc+A.user.gioia.aioe.org!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Creating several types from a base type and conversion Date: Sun, 19 Jan 2020 14:51:36 +0000 Organization: Aioe.org NNTP Server Message-ID: References: <4b0649b3-aed2-44fd-822f-d6665b9352dd@googlegroups.com> <536e9961-f454-44d9-95a6-aecaaee1addf@googlegroups.com> <516be7e3-4be3-4697-adb0-9fbde4d5b7e6@googlegroups.com> NNTP-Posting-Host: Oh2LSLzxQ4+YU0Htrufc+A.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (darwin) X-Notice: Filtered by postfilter v. 0.9.2 Cancel-Lock: sha1:leJxrP2D/6NI9k3g68Jqz52Ov54= Xref: reader01.eternal-september.org comp.lang.ada:57896 Date: 2020-01-19T14:51:36+00:00 List-Id: AdaMagica writes: > 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. > > See https://en.wikibooks.org/wiki/Ada_Programming/Attributes/%27Bit_Order > > This is a complete description of how far we can get with endian > independence in current Ada. Ada 202x won't change anything in this > respect. The description is still, I feel, confusing. That said, I found this incantation (for an SNTP packet, which is transmitted in network byte order) works a treat on this LE machine. I don't have a BE machine to check it on (but the original code was used on both BE and LE machines). end record with Bit_Order => System.High_Order_First, Scalar_Storage_Order => System.High_Order_First, Size => 48 * 8;