Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!compass!worley From: worley@compass.com (Dale Worley) Newsgroups: comp.lang.c Subject: Re: towards a faster isdigit() Message-ID: Date: 8 May 91 18:23:58 GMT References: <1991May8.030515.7004@twinsun.com> <1991May8.154453.4462@intellistor.com> Sender: root@compass.com Distribution: usa Organization: Compass, Inc., Wakefield, MA, U.S.A. Lines: 15 In-reply-to: wicklund@intellistor.com's message of 8 May 91 15:44:53 GMT In article <1991May8.154453.4462@intellistor.com> wicklund@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@compass.com -- Why are you RUNNING? Cerebus just wants to KILL you a little... -- "Cerebus"