From: Marco Costalba Date: Sun, 30 Dec 2007 15:17:52 GMT Subject: Re: [PATCH] Optimize prefixcmp() Message-ID: In-Reply-To: On Dec 30, 2007 3:50 PM, Marco Costalba wrote: > > If *prefix == "" case is to be considered I vote for your/Johannes > version because it's "better code" (tm). > Ok this is fast and correct static inline int prefixcmp(const char *str, const char *prefix) { while (*str == *prefix && *prefix) str++, prefix++; return (*prefix ? *(unsigned const char *)prefix - *(unsigned const char *)str : 0); } This is the last one, I promise ;-) Marco