httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: cvs commit: apache-1.3/src/main util.c
Date Sun, 15 Mar 1998 21:09:40 GMT


On Sun, 15 Mar 1998, Martin Kraemer wrote:

> >   -#define TEST_CHAR(c, f)	(test_char_table[((unsigned char)(c)) & 0xff] &
(f))
> >   +/* we assume the folks using this ensure the char < 256 */
> >   +#define TEST_CHAR(c, f)	(test_char_table[(unsigned)(c)] & (f))
> 
> Wouldn't it have been sufficient to simply remove the "& 0xFF" part? 
> The (unsigned char) cast guarantees results between 0 and 255 anyway. 
> The new version doesn't guarantee an index in the range 0..255 any
> longer, since the sign expansion of a (signed) char is done before the
> cast to unsigned. So '\377' -> -1 -> 0xFFFFFFFFU now. 

Yeah you're right, but I don't want a cast to (unsigned char) there
because there are already such casts required in certain uses of this
macro... and doing it twice makes gcc generate really lame code.  But I'll
clean it up and doc it better.  Thanks. 

Dean



Mime
View raw message