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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7e490a18b9688bd9 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.11.4 with SMTP id m4mr119286pbb.31.1316017212704; Wed, 14 Sep 2011 09:20:12 -0700 (PDT) Path: m9ni6214pbd.0!nntp.google.com!news1.google.com!goblin2!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Stream_Element_Array Date: Wed, 14 Sep 2011 17:20:11 +0100 Organization: A noiseless patient Spider Message-ID: References: <1e6rw4vto3ldb.i8d7fxixapx4.dlg@40tude.net> <12t67nj6zlq5u$.f0bz4sdy17te.dlg@40tude.net> <17a3fc710wyy6$.rfujippaxo99.dlg@40tude.net> Mime-Version: 1.0 Injection-Info: mx04.eternal-september.org; posting-host="dFCm8HWntFqmDIilBLqEJQ"; logging-data="11640"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ctXBjVCoWjgj0rmdX/IC+3pPARBF6Dtc=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (darwin) Cancel-Lock: sha1:uOpWd9kvfz+6owjuG32UIqm1I/s= sha1:ZN3/v+fvYSho5WRErsdtYLjrqcw= Xref: news1.google.com comp.lang.ada:17967 Content-Type: text/plain; charset=us-ascii Date: 2011-09-14T17:20:11+01:00 List-Id: "Dmitry A. Kazakov" writes: > On Wed, 14 Sep 2011 11:18:30 +0100, Simon Wright wrote: > >> "Dmitry A. Kazakov" writes: >> >>> On Wed, 14 Sep 2011 11:40:01 +0200, Dmitry A. Kazakov wrote: >>> >>>> -- Little endian implementation of Get for Unsigned_16 >>>> procedure Get >>>> ( Source : Stream_Element_Array; >>>> Index : in out Stream_Element_Offset; >>>> Data : out Unsigned_16 >>>> ) is >>>> begin >>>> Data := Stream_Element'Pos (Source (Index)) + >>>> Stream_Element'Pos (Source (Index + 1)); >>> >>> Rather: >>> >>> Stream_Element'Pos (Source (Index + 1)) * 256; >> >> That's an implementation where both the stream and the processor are >> little-endian. > > It is an implementation when the format of unsigned 16 is little > endian. The processor endianness can be any, which is the point of > doing it this way. I agree about the processor endianness, I was wrong. However, to call it the "format of Unsigned_16" could be a little misleading, it's the format of Unsigned_16 *on the wire* that's little-endian.