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: clever algorithm string ->int id wanted
From: phil_at_x-phobie.de
Date: 2002-10-04


On Thu, 3 Oct 2002 16:40:55 -0400, "M. OReilly"
<moreilly_at_moreilly.com> wrote:

>Would a simple checksum work? A two digit hex checksum would be enough for
>256 unique entries.

Maybe a checksum is not sufficiant to really distinguish two different
strings. BTW I wouldn't be surprised if we exceed a limit of 256
different commands. Well. Somewhen, maybe.

I read in
http://java.sun.com/j2se/1.4.1/docs/api/java/lang/String.html#hashCode()
that they make a hash key for strings with

s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]

Because I'm not that much interested in speed while loading a key
scheme I'll take that (in spite of all those multiplications) unless I
accidently stumble across something better.

Phil



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