mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
More optimisation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28333 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d125441985
commit
08c9289397
2 changed files with 23 additions and 12 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
* Source/Additions/Unicode.m: Optimise case where we are converting
|
||||
from unicode to latin1 or ascii.
|
||||
* Source/GSString.m: Optimise -hash method of NXConstantString too.
|
||||
|
||||
2009-06-06 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
|
|
|
@ -5053,15 +5053,24 @@ NSAssert(_flags.owned == 1 && _zone != 0, NSInternalInconsistencyException);
|
|||
|
||||
if (len > 0)
|
||||
{
|
||||
const unsigned char *p;
|
||||
unsigned char_count = 0;
|
||||
register const unsigned char *p;
|
||||
register unsigned index = 0;
|
||||
|
||||
p = _self->_contents.c;
|
||||
while (char_count++ < len)
|
||||
if (internalEncoding == NSISOLatin1StringEncoding)
|
||||
{
|
||||
unichar u = *p++;
|
||||
while (index < len)
|
||||
{
|
||||
ret = (ret << 5) + ret + p[index++];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (index < len)
|
||||
{
|
||||
unichar u = p[index++];
|
||||
|
||||
if (u > 127 && internalEncoding != NSISOLatin1StringEncoding)
|
||||
if (u > 127)
|
||||
{
|
||||
unsigned char c = (unsigned char)u;
|
||||
unsigned int s = 1;
|
||||
|
@ -5071,6 +5080,7 @@ NSAssert(_flags.owned == 1 && _zone != 0, NSInternalInconsistencyException);
|
|||
}
|
||||
ret = (ret << 5) + ret + u;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The hash caching in our concrete string classes uses zero to denote
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue