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 10.224.55.129 with SMTP id u1mr169329qag.6.1391590958499; Wed, 05 Feb 2014 01:02:38 -0800 (PST) X-Received: by 10.140.49.175 with SMTP id q44mr1262qga.39.1391590958477; Wed, 05 Feb 2014 01:02:38 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!k15no12571956qaq.0!news-out.google.com!y18ni3756qap.1!nntp.google.com!k15no12571951qaq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 5 Feb 2014 01:02:38 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=91.7.62.191; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf NNTP-Posting-Host: 91.7.62.191 References: <20a36d96-850e-4020-8dfa-777eb9c944f4@googlegroups.com> <9e27abb7-e944-4bd4-a10c-600fe4da7872@googlegroups.com> <56a5aeb6-8704-457c-a24f-b664746afe72@googlegroups.com> <13pvagjpwejni$.1e8ll5btxg1f5$.dlg@40tude.net> <5bf8c737-b99d-4069-885f-03fe82f06cc6@googlegroups.com> <14k7gbu5ws82b.3pn20kh5ci50.dlg@40tude.net> <1txs6yifzioke$.30cghpl6qq1j$.dlg@40tude.net> <18q1ats1rko50$.zp43ryd37uis.dlg@40tude.net> <51bc4e33-df01-4048-802f-587ef81f93ac@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Binary and XML serialization of types From: AdaMagica Injection-Date: Wed, 05 Feb 2014 09:02:38 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 4227 X-Received-Body-CRC: 3054819136 Xref: news.eternal-september.org comp.lang.ada:18387 Date: 2014-02-05T01:02:38-08:00 List-Id: On Tuesday, February 4, 2014 11:34:15 PM UTC+1, Simon Wright wrote: > AdaMagica writes: > > that's why in Ada bits are counted also right to left so that we count > > contiguously past byte boundaries. > If you are on a BE machine and you are writing a representation clause > (Ada < 2012) then, for a byte, the msb is bit 0 and the lsb is bit 7. > I'm natively little-endian, and if I'm drawing a 4-byte memory quantity > on a single line I will draw the ls byte and the ls bit within it on the > right regardless of the intended endianness. I don't know for sure what > people whose first computer was big-endian do, but I suspect it's the > same (perhaps not for people whose writing system is right-to-left) (but > see the third comment in [1], showing that at least one respected > individual thinks differently!). > So I don't see how "in Ada bits are counted [also] right to left". > [1] http://www.adacore.com/adaanswers/gems/gem-140-bridging-the-endiannes= s-gap/ I know this quite well, I had my deal with porting original BE code to a LE= machine. You omitted the essential part of my post: LE. "That's why LE machines count from right to left (bytes, that is); that's why in Ada bits are counted also right to left so that we count cont= iguously past byte boundaries." On BE machines, it's the other way round of course. And that's still correc= t in Ada2012. So, independently of the endianness, the MSB is always on the left. That's = why Shift_Left and Shift_Right and Shift_Right_Arithmetic work the same ind= ependently of the endianness. Now it's quite common to put the more significant digits left to the less s= ignificant ones. Chinese do it (in their pictographic digits =E4=B8=80=E4= =BA=8C=E4=B8=89=E5=9B=9B=E4=BA=94=E5=85=AD=E4=B8=83=E5=85=AB=E4=B9=9D=E5=8D= =81); also arabs do it (in their digits =D9=A1=D9=A2=D9=A3=D9=A4=D9=A5=D9= =A6=D9=A7=D9=A8=D9=A9=D9=A0), although they write from right to left (they = also say the most significant part first, except for the numbers 11 to 99, = they say them like we do in German, 25 =3D =D8=AE=D9=85=D8=B3=D8=A9 =D9=88= =D8=B9=D8=B4=D8=B1=D9=8A=D9=86, hamsa wa ashrin, f=C3=BCnf und zwanzig, fiv= e plus twenty). I don't know for other writing systems.