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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,43ad9ab56ebde91c X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.191.41 with SMTP id gv9mr2537580pbc.5.1323886611485; Wed, 14 Dec 2011 10:16:51 -0800 (PST) Path: lh20ni22353pbb.0!nntp.google.com!news1.google.com!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Does Ada support endiannes? Date: Wed, 14 Dec 2011 19:16:46 +0100 Organization: cbb software GmbH Message-ID: References: <23835087-313f-427c-b37e-4ff1bdef9d57@r6g2000yqr.googlegroups.com> <108d5437-ae36-4e79-ad4e-aab3b903d0f4@gl2g2000vbb.googlegroups.com> <2f9744b6-4a45-4dd1-9621-c6f5d10166cb@r6g2000yqr.googlegroups.com> <0a7b55fd-1ecf-4a40-979c-12ce44071be9@p9g2000vbb.googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: BChg1jyHRzVQHsaTbkEJkw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2011-12-14T19:16:46+01:00 List-Id: On Wed, 14 Dec 2011 08:16:02 -0800 (PST), Gerd wrote: > On 13 Dez., 15:19, Gautier write-only > wrote: > > Are you sure the "/" and mod would work correct? Always. Arithmetic is complete in the sense that any possible function can be implemented using these operations. > Assume, that the Value 16#000000FF# shall be converted to > 16#FF000000# > > Native : Integer := 16#000000FF#; > > Remote : Integer; > > Remote := 16#01000000# * ()Native mod 16#000000FF#); -- overflow! Either it is not Integer (e.g. Unsigned_32) or else overflow is not an error but a legal outcome indicating protocol error, for example. The decision depends on the application. Note that if you used a representation clause and/or Unchecked_Conversion, you would have to use X'Valid attribute in order to check obtained value for being an integer. For all cases where arithmetic would raise Constraint_Error, X'Value should yield false, which is not guaranteed of course. This is another reason why not to use representation clauses, because some illegal representation might get misinterpreted as proper values. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de