lkml.org 
[lkml]   [1998]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 2.1.120pre2: Bug in strnicmp() noted in 2.1.119pre1 is still there!
On Mon, Aug 31, 1998 at 10:29:28AM -0700, Linus Torvalds wrote:
> Ok, shoot holes in this one instead.
>
> Linus

Say, it looks like you can save an occasional subtraction if you
replace the sequence

> c1 = tolower(c1);
> c2 = tolower(c2);

with:
--------------------------------
if(islower(c2))
if(isupper(c1))
c1-='A'-'a';
else /* c1 c2 same case */
goto different;
else /* c2 is upper case */
if(islower(c1))
c1-='a'-'A';
else /* c1 c2 same case */
goto different;
----------------------------------------------
The extra subtraction is saved by the "else goto's" when it becomes
clear you don't have to convert the case of c1.

Robert

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html

\
 
 \ /
  Last update: 2005-03-22 13:44    [W:0.055 / U:0.900 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site