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,553a6b79b2471571 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!novia!newsfeed.icl.net!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: How do you bitwise operations in Ada '83 and '95 Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <9315684D-C216-4EDA-8852-0A6BD4C275B0@amado-alves.info> <1e7szqc5niq0u$.1oqd2mhiiccyx.dlg@40tude.net> <71nkuwdmd7v5.xs4ho9ifpcfx$.dlg@40tude.net> <130aai4of5k0s.1175ed13axp2v.dlg@40tude.net> <1153565549.10562.4.camel@localhost.localdomain> Date: Sat, 22 Jul 2006 15:31:51 +0200 Message-ID: <1nowig1kxgfa5.1srr0m5ax4ry6$.dlg@40tude.net> NNTP-Posting-Date: 22 Jul 2006 15:31:51 MEST NNTP-Posting-Host: aa395460.newsread2.arcor-online.net X-Trace: DXC=hYak2Mhiheici]h2U0KHceQ5U85hF6f;djW\KbG]kaMhU7^]5?JhlBnEZ3I>[oU0Ub[6LHn;2LCVn[Nmae X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:5876 Date: 2006-07-22T15:31:51+02:00 List-Id: On Sat, 22 Jul 2006 12:52:29 +0200, Georg Bauhaus wrote: > On Sat, 2006-07-22 at 10:32 +0200, Dmitry A. Kazakov wrote: > >> Does ANSI C standard require (x<<1) == (x*2)? >> >> As for Ada 95, ARM certainly does not. This is why Shift_* is not portable. > > type Unsigned_n is mod 2**n; -- Annex B.2 > > won't be portable for the same reason? Why? Semantics of modular arithmetic is defined in a portable way. As long as you deal with *numbers* everything is OK. > As for the bit representation of these intrinsic modular values, > wouldn't shift_left etc. have to provide a result that does > make sense, as per the AS-IF rule? I am not a language lawyer. To me shifts aren't numeric operations, but ones on arrays of bits. Mixing both is asking for trouble. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de