Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: Optimizing to functions for a plugin

Re: Optimizing to functions for a plugin

From: Rene Peinthor <peinthor_at_gmail.com>
Date: Wed, 15 Oct 2008 21:05:07 +0200

static unsigned long string_to_long(const char* toConvert)
{
    unsigned long result = 0;
    const char* c;
    unsigned int i;
    unsigned long pow_of_10 = 1;

    for(c = &toConvert[ rb->strlen(toConvert)-1]; c != toConvert; --c) {
        result += char_to_long(*c) * pow_of_10;
        pow_of_10 *= 10;
    }
    result += char_to_long(*c) * pow_of_10;

    return result;
}

This should be a faster version of string_to_long, because it doesn't need
the first loop.

Rene
Received on 2008-10-15


Page was last modified "Jan 10 2012" The Rockbox Crew
aaa