Re: [patch] signed char fix for awe driver

From: Russell King (rmk@arm.linux.org.uk)
Date: Sun Jun 11 2000 - 11:39:29 EST


Matti Aarnio writes:
> On Sun, Jun 11, 2000 at 04:30:42PM +0100, Philip Blundell wrote:
> > - char fixkey, fixvel; /* fixed key, velocity */
> > + signed char fixkey, fixvel; /* fixed key, velocity */
>
> Philip, just curious, which CPU has its 'char' type
> defaulted to unsigned ?
>
> These days most systems seem to run with 'char' == 'signed char',
> while many older systems were 'char' == 'unsigned char'.
> (I still remember that Sun changed the default way way back at
> SunOS systems, and it caused some of my code to break back then.
> A great educational experience that one..)

Many ARM processors are more efficient with unsigned chars (it saves
two instructions per load of a signed char to promote the char to a
32-bit quantity required for signed arithmetic).

There are other current architectures which this is also a win.

IMHO not specifing signed/unsignedness where it matters is a sign
of bad programming practise, especially with code which is meant to
be portable.
   _____
  |_____| ------------------------------------------------- ---+---+-
  | | Russell King rmk@arm.linux.org.uk --- ---
  | | | | http://www.arm.linux.org.uk/~rmk/aboutme.html / / |
  | +-+-+ --- -+-
  / | THE developer of ARM Linux |+| /|\
 / | | | --- |
    +-+-+ ------------------------------------------------- /\\\ |

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Jun 15 2000 - 21:00:23 EST