mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-28 02:12:28 +00:00
avcodec/xbmenc: Pre-compute variables once for parse_str_int()
Some compilers are very intuitive, and others are not so much, so let's pre-compute the variables e and keylen outside the for loop. Ensuring a minor speed increase regardless of if compiler is smart enough to solve this improvement for itself, or not. Signed-off-by: Joe Da Silva <digital@joescat.com>
This commit is contained in:
parent
b6bc981d25
commit
42c636c972
@ -39,11 +39,14 @@ static int convert(uint8_t x)
|
||||
|
||||
static int parse_str_int(const uint8_t *p, const uint8_t *end, const uint8_t *key)
|
||||
{
|
||||
for(; p<end - strlen(key); p++) {
|
||||
if (!memcmp(p, key, strlen(key)))
|
||||
int keylen = strlen(key);
|
||||
const uint8_t *e = end - keylen;
|
||||
|
||||
for(; p < e; p++) {
|
||||
if (!memcmp(p, key, keylen))
|
||||
break;
|
||||
}
|
||||
p += strlen(key);
|
||||
p += keylen;
|
||||
if (p >= end)
|
||||
return INT_MIN;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user