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



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.

Some useful references about C:
<http://c-faq.com/> (C-faq)
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf> (C99)
<http://cbfalconer.home.att.net/download/n869_txt.bz2> (C99, txt)
<http://www.dinkumware.com/c99.aspx> (C-library}

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.


.



Relevant Pages

  • Re: >> to accelerate division
    ... Xenos wrote: ... > arithmetic shift operations. ... as required by C99 and recommended by C89/C90 and C++ ... standards. ...
    (comp.lang.c)
  • Re: Antennas led astray
    ... unless the galaxy is perfectly perpendicular to us. ... magnitude of the shift? ...
    (rec.radio.amateur.antenna)