towards a faster isdigit()

Andy Newman andy at research.canon.oz.au
Thu May 9 12:55:52 AEST 1991


eggert at 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 at research.canon.oz.au) Canon Info. Systems Research Australia
	"If education were illegal would more people would try it?"



More information about the Comp.lang.c mailing list