Float loading speedup.

SVN revision: 31940
This commit is contained in:
Gustavo Sverzut Barbieri 2007-10-03 00:08:41 +00:00
parent 24eea4e7a7
commit 64f3e597e0
1 changed files with 13 additions and 0 deletions

View File

@ -370,6 +370,19 @@ eet_data_get_float(void *src, void *src_end, void *dst)
p = s;
len = 0;
while ((p < (char *)src_end) && (*p != 0)) {len++; p++;}
/* fast handle of simple case 0xMp+E*/
if ((len == 6) && (s[0] == '0') && (s[1] == 'x') && (s[3] == 'p'))
{
int mantisse = (s[2] >= 'a') ? (s[2] - 'a' + 10) : (s[2] - '0');
int exponent = 1 << (s[5] - '0');
if (s[4] == '+') *d = ((float)mantisse) * (float)exponent;
else *d = ((float)mantisse) / (float)exponent;
return len + 1;
}
str = alloca(len + 1);
memcpy(str, s, len);
str[len] = '\0';