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
|
* Source/Additions/Unicode.m: Optimise case where we are converting
|
||||||
from unicode to latin1 or ascii.
|
from unicode to latin1 or ascii.
|
||||||
|
* Source/GSString.m: Optimise -hash method of NXConstantString too.
|
||||||
|
|
||||||
2009-06-06 Wolfgang Lux <wolfgang.lux@gmail.com>
|
2009-06-06 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
|
|
|
@ -5053,23 +5053,33 @@ NSAssert(_flags.owned == 1 && _zone != 0, NSInternalInconsistencyException);
|
||||||
|
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
const unsigned char *p;
|
register const unsigned char *p;
|
||||||
unsigned char_count = 0;
|
register unsigned index = 0;
|
||||||
|
|
||||||
p = _self->_contents.c;
|
p = _self->_contents.c;
|
||||||
while (char_count++ < len)
|
if (internalEncoding == NSISOLatin1StringEncoding)
|
||||||
{
|
{
|
||||||
unichar u = *p++;
|
while (index < len)
|
||||||
|
|
||||||
if (u > 127 && internalEncoding != NSISOLatin1StringEncoding)
|
|
||||||
{
|
{
|
||||||
unsigned char c = (unsigned char)u;
|
ret = (ret << 5) + ret + p[index++];
|
||||||
unsigned int s = 1;
|
}
|
||||||
unichar *d = &u;
|
}
|
||||||
|
else
|
||||||
GSToUnicode(&d, &s, &c, 1, internalEncoding, 0, 0);
|
{
|
||||||
|
while (index < len)
|
||||||
|
{
|
||||||
|
unichar u = p[index++];
|
||||||
|
|
||||||
|
if (u > 127)
|
||||||
|
{
|
||||||
|
unsigned char c = (unsigned char)u;
|
||||||
|
unsigned int s = 1;
|
||||||
|
unichar *d = &u;
|
||||||
|
|
||||||
|
GSToUnicode(&d, &s, &c, 1, internalEncoding, 0, 0);
|
||||||
|
}
|
||||||
|
ret = (ret << 5) + ret + u;
|
||||||
}
|
}
|
||||||
ret = (ret << 5) + ret + u;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue