Re: ARM7, DSP and mobile phone, how and why?

From: glen herrmannsfeldt (gah_at_ugcs.caltech.edu)
Date: 06/15/04


Date: Tue, 15 Jun 2004 03:27:55 GMT


(comp.lang.c added)

Wilco Dijkstra wrote:
> "42Bastian Schick" <bastian42@yahoo.com> wrote in message
> news:40cd3766.153017817@news.individual.de...

>>On Thu, 10 Jun 2004 16:50:47 -0400, Jerry Avins <jya@ieee.org> wrote:

>>>>This code doesn't look portable to me. shifts are not
>>>>guaranteed to fill with the sign bit.
>>>>Of course in the context of ARM compilers this should be OK.

(snip)

>>>HLL that doesn't offer both arithmetic and logical shifts when the
>>>processor supports the is a crippled abomination.

>>The question is, does the C or C++ standard define whether
>>right-shifts are signed or unsigned ?
(snip)

> However compiler writers agree on most of these things (if they didn't
> then their customers would force them anyway) so in reality most code
> is portable across many compilers and architectures with little effort.
> And yes I've never heard of a compiler that didn't support signed right
> shifts corectly. The reason C89 didn't define signed arithemetic properly
> was to allow 1-complements arithmetic. So if you want to make your
> code compliant think 1-complements whenever you do anything.

C supports both 1's complement and sign magnitude, though I
don't know of any current producers of fixed point sign
magnitude machines. I am told that Unisys still makes
ones complement machines. As long as that is true, you can't
rely on the results of signed shift.

I believe, though, that a conforming C implementation can do
logical right shift on signed data.

-- glen



Relevant Pages

  • Re: VECTOR data types and intrinsic functions
    ... and compilers have been able to generate code for it ... from standard f77 onwards. ... a preprocessor could convert the VECTOR style to a more ...
    (comp.lang.fortran)
  • Re: Is Fortran still faster than C for math applications?
    ... >>IAND corresponds to the x86 shift and rotate instructions that ... >>take the shift count mod 32. ... Without the IAND the compilers ... I have always assumed in my Alpha assembly code. ...
    (comp.lang.fortran)
  • Re: need help..
    ... snip ... ... > I don't like this habit for various reasons: ... > to read unless you are already quite used to reversing the test. ... > for a fact only that gcc and HP's compilers do this (and not because the ...
    (comp.lang.c)
  • Re: Saturday night chat (at least in the US)
    ... computer system...and they gave us more paperwork to fill out every ... shift. ... I took care of two tiny (less than 2 ...
    (rec.food.cooking)
  • Re: Why do you like C more than other programming languages?
    ... non-portability into their code by using C99 features. ... implementors can't even be bothered to implement C90 properly... ... If C99 compilers were readily available (and implemented at least ...
    (comp.lang.c)