GNU Emacs 18.55 and AIX PS/2 1.1

Michael Meissner meissner at twohot.rtp.dg.com
Tue Oct 17 01:49:34 AEST 1989


In article <2896 at netcom.UUCP> hue at netcom.UUCP (Jonathan Hue) writes:
>  It's not a bug - chars are unsigned in the PS/2's compiler.  It shouldn't 
>  extend the sign when promoting to an int.  When I brought up 18.52 I used
>  something like the following:
>  
>  #define SIGN_EXTEND_CHAR(x) ((x) & 0x80 ? ((x) - 255) : (x))

A usually more efficent way of sign extending characters (depending
on how much branches cost in terms of hardware speed or compiler
optimizations) is:

#define SIGN_EXTEND_CHAR(a) ((((a) & 0xFF) ^ 0x80) -  0x80)

The & 0xFF can be eliminated if you are sure that a is in fact a char
variable and not an integer, since that automatically occurs in
promoting an unsigned char to int.
--

Michael Meissner, Data General.				If compiles where much
Uucp:		...!mcnc!rti!xyzzy!meissner		faster, when would we
Internet:	meissner at dg-rtp.DG.COM			have time for netnews?



More information about the Comp.unix.aix mailing list