Re: arm9e: how do I invert sign of a halfword?
- From: mojaveg@xxxxxxxxxxxxxxxxxx (Everett M. Greene)
- Date: Sun, 27 Jul 2008 21:34:57 PST
Frank Buss <fb@xxxxxxxxxxxxx> wrote:
Everett M. Greene wrote:
VV's (corrected) solution works in all cases. Wilco's
is suspect for large values (>0x40000000), but I haven't
investigated the boundary cases.
It works for values > 0x3fff, because it doesn't matter that
the LSL #17 shift operation shifts the highest bit out of the
32 bit register, because subtracting 0x10000 from any 16 bit
word results still in the same 16 bit word, only the upper
(not present) bits are switched all to 1. Nice solution!
The point I was raising was that shifting a value between
0x4000 and 0x7FFF left one place results in a significant
bit being shifted into the sign bit. There was a question
in my mind as to whether that would work correctly.
I have since run a simulation of the process and find it
works in all cases except the one value of 0x8000. Of
course, no solution works in this case...
.
- Follow-Ups:
- 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: New Yahoo Group for Blackfin DSP/MCU
- Next by Date: Re: computer-driven fans II
- Previous by thread: Embedded Unit test with TestApe
- Next by thread: Re: arm9e: how do I invert sign of a halfword?
- Index(es):