C code optimization for a = (b < c); (correction)

WILCOX at nosc-tecr.arpa WILCOX at nosc-tecr.arpa
Sun May 28 08:26:19 AEST 1989


Wooops!  I was thinking of the signed form and got put "c - b" instead
of "b - c".  Unsigned form should be:

a = (b < c); ==>

a = (unsigned)((b - c) >> (WIDTH_OF_INT_IN_BITS - 1));

     --Dwight Wilcox
       Code 412
       Naval Ocean Systems Center
       San Diego, CA  92152-5000



More information about the Comp.unix.wizards mailing list