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!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!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> Date: Sat, 22 Jul 2006 10:32:19 +0200 Message-ID: <130aai4of5k0s.1175ed13axp2v.dlg@40tude.net> NNTP-Posting-Date: 22 Jul 2006 10:32:01 MEST NNTP-Posting-Host: a2640b16.newsread2.arcor-online.net X-Trace: DXC=oa\0?U40maJUo1RUcdhQmEQ5U85hF6f;DjW\KbG]kaMHU7^]5?JhlBN[AIiXTW2E:F[6LHn;2LCVN[NmaE X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:5873 Date: 2006-07-22T10:32:01+02:00 List-Id: On Fri, 21 Jul 2006 20:03:09 +0100, Simon Wright wrote: > "Dmitry A. Kazakov" writes: > >> It depends on endianness. Provided that storage elements are octets >> on both machines, which assumption could be wrong, 128 shifted left >> might yield 0, 256 or even 64 (what is "left"?). > > You might as well argue that the C operator<< could produce 64 or 256. I can't tell for C. Does ANSI C standard require (x<<1) == (x*2)? As for Ada 95, ARM certainly does not. This is why Shift_* is not portable. Then Interfaces, where Shift_* is declared, does not refer to C, anyway. >> When considering *any* thinkable architecture, it might be even >> impossible to implement Shift_* at all. Let some crazy hardware >> store numbers in only odd bits, reserving even ones for something >> else (like a check-sum). On such imaginary hardware Shift_Left (*, >> 1) wouldn't even yield a valid number! Actually "they operate on a >> bit-by-bit basis" is quite hazy. What is bit? Which bits are >> adjacent? How are they ordered? What does "left" mean? Which bits >> are of the number? etc. > > One would think the market for hardware like that would be pretty > thin; not really a "thinkable" architecture. Certainly not > interesting. Ah, but the standard is silent about interesting vs. uninteresting bit representations. Anyway, middle-endian machines still exist and produced. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de