Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!munnari.oz.au!metro!kwanon!andy From: andy@research.canon.oz.au (Andy Newman) Newsgroups: comp.lang.c Subject: Re: towards a faster isdigit() Message-ID: <1991May9.025552.2292@research.canon.oz.au> Date: 9 May 91 02:55:52 GMT References: <1991May8.030515.7004@twinsun.com> <716@taumet.com> Sender: andy@research.canon.oz.au (Andy Newman) Reply-To: andy@research.canon.oz.au (Andy Newman) Organization: Canon Information Systems Research Australia Lines: 12 eggert@twinsun.com (Paul Eggert) writes: > Why not use the following implementation instead? > > #define isdigit(c) ((unsigned)((c)-'0') < 10) Only works for character sets that have the decimal digits arranged contiguously and with digit '0' having a lower numeric value than any other digit character. This works for ASCII and EBCDIC but what about other character sets? -- Andy Newman (andy@research.canon.oz.au) Canon Info. Systems Research Australia "If education were illegal would more people would try it?"