Re: arm9e: how do I invert sign of a halfword?
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Thu, 31 Jul 2008 08:58:20 -0400
Wilco Dijkstra wrote:
"CBFalconer" <cbfalconer@xxxxxxxxx> wrote:
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.
If you go back to the original post in this thread, you will find C
code proposed. In addition, something like 90% of embedded
programming is done in C. If you want to consider other languages,
it is necessary to state that in an obvious place.
The C standard allows for the use of non-standard systems and
extensions. However, any sane programmer makes sure such items are
clearly marked and identified. Your statement about the standard
is wrong, to put it gently.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
.
- Follow-Ups:
- Re: arm9e: how do I invert sign of a halfword?
- From: Wilco Dijkstra
- Re: arm9e: how do I invert sign of a halfword?
- References:
- Re: arm9e: how do I invert sign of a halfword?
- From: Everett M. Greene
- Re: arm9e: how do I invert sign of a halfword?
- From: CBFalconer
- Re: arm9e: how do I invert sign of a halfword?
- From: Wilco Dijkstra
- Re: arm9e: how do I invert sign of a halfword?
- From: CBFalconer
- Re: arm9e: how do I invert sign of a halfword?
- From: Wilco Dijkstra
- Re: arm9e: how do I invert sign of a halfword?
- From: CBFalconer
- Re: arm9e: how do I invert sign of a halfword?
- From: Wilco Dijkstra
- Re: arm9e: how do I invert sign of a halfword?
- From: CBFalconer
- Re: arm9e: how do I invert sign of a halfword?
- From: Wilco Dijkstra
- Re: arm9e: how do I invert sign of a halfword?
- Prev by Date: Re: arm9 memory throughput
- Next by Date: Re: arm9e: how do I invert sign of a halfword?
- Previous by thread: Re: arm9e: how do I invert sign of a halfword?
- Next by thread: Re: arm9e: how do I invert sign of a halfword?
- Index(es):
Relevant Pages
|