Re: arm9e: how do I invert sign of a halfword?




"CBFalconer" <cbfalconer@xxxxxxxxx> wrote in message news:4890FCB4.383827B8@xxxxxxxxxxxx
Wilco Dijkstra wrote:
"CBFalconer" <cbfalconer@xxxxxxxxx> wrote:

... snip ...

Just consider the meaning and action on machines using ones
complement or sign-magnitude conventions. Also the fact that the
occurence of an overflow can cause implementation defined action.

I did consider that and this is exactly why the C standard is
incorrect:

Arithmetic one-complement shifts shift the sign into either the
MSB (right shift) or LSB (left shift). Sign magnitude only shifts
the magnitude for both left and right shift. This gives the
correct arithmetic results, ie. -0 stays -0, -1 becomes -0 on a
right shift, and -2 on a left shift etc.

Please give a reference section (s) in the C99 standard that
imposes this.

The standard has nothing to do with this. Remember you asked me to
"consider the meaning and action on machines using ones complement
or sign-magnitude conversions". That's what I did, and I described how
shifts work on such machines, and that there is clearly no reason for
left shifts to be undefined when right shifts are implementation defined.

Once you understand that, you'll understand the C standard is incorrect.

Wilco


.



Relevant Pages

  • Re: arm9e: how do I invert sign of a halfword?
    ... complement or sign-magnitude conventions. ... I did consider that and this is exactly why the C standard is ... MSB (right shift) or LSB. ...
    (comp.arch.embedded)
  • Re: C++ more efficient than C?
    ... don't disagree about how much one can shift by. ... the chapter 7.5 Shift Operators you find: ... compiler. ... A lot of the undefined behaviour in the standard is there so ...
    (comp.programming)
  • Re: Survey about future Sun keyboards and mice
    ... Chris Morgan wrote: ... >I like Ctrl to be below Shift, and I love the feel of the Type 6 ... The "pc-way as standard" is due ONLY to it being IBM, Big Blue, ...
    (comp.unix.solaris)
  • Re: Survey about future Sun keyboards and mice
    ... Chris Morgan wrote: ... >I like Ctrl to be below Shift, and I love the feel of the Type 6 ... The "pc-way as standard" is due ONLY to it being IBM, Big Blue, ...
    (comp.sys.sun.hardware)
  • Re: Campy CT cranks - is CT fr der required?
    ... straight answer as to whether I "need" aCTfront derailleur. ... Man, count me in the "only use the standard double FD, period" camp. ... and even then would balk at moving the chain. ... couldn't get the front to shift well. ...
    (rec.bicycles.tech)