Re: How do you bitwise operations in Ada '83 and '95



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
.



Relevant Pages

  • Re: Dynamically resizing a buffer
    ... Because you consider shift an appropriate method of halving a number. ... define the result of right shifting a negative number). ... however, I reason, almost none of my crap is ever likely to be run on ... Linear is another natural growth curve. ...
    (comp.lang.c)
  • Re: Yet another "you cant take photos in a public place" story....
    ... I'm sure I'll be corrected if I'm wrong but I assumed trespass was ... direction given to you by the land owner/agent and as expeditiously as ... and use as much force as is reasonable and necessary to shift you. ... leave" etc is more than enough reason for the ...
    (uk.legal)
  • Re: create a hierarchical list from a text file
    ... > sub read_items { ... You should not use global variables without a good reason. ... my $file = shift; ...
    (comp.lang.perl.misc)
  • Re: How do you bitwise operations in Ada 83 and 95
    ... As for Ada 95, ARM certainly does not. ... This is why Shift_* is not portable. ... won't be portable for the same reason? ... As for the bit representation of these intrinsic modular values, ...
    (comp.lang.ada)
  • Re: Math failure?? (Rick failure??) with optimizations enabled
    ... that a shift can probably compile to a shift, ... best reason I could think of. ... architectures, and presumably others, mask the shift delta for a ... How do I propose to generate the compiler error? ...
    (comp.lang.c)