towards a faster isdigit()

Dale Worley worley at compass.com
Thu May 9 04:23:58 AEST 1991


In article <1991May8.154453.4462 at intellistor.com> wicklund at intellistor.com (Tom Wicklund) writes:
   2) The (unsigned) cast may not work (I think an implementation could
   return abs(x) as the result of an (unsigned) cast but am not sure),
   so (unsigned)(c-'0') would be TRUE for "c" in the range '0'-9 .. '0'+9.

No, it can't.  The conversion of a signed integer to an unsigned
integer has to be done by the traditional modular arithmetic.  See
section 3.2.1.2 of the ANSI specification.

Dale

Dale Worley		Compass, Inc.			worley at compass.com
--
Why are you RUNNING?  Cerebus just wants to KILL you a little...
-- "Cerebus"



More information about the Comp.lang.c mailing list