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



Rockbox mail archive

Subject: RE: clever algorithm string ->int id wanted

RE: clever algorithm string ->int id wanted

From: M. OReilly <moreilly_at_moreilly.com>
Date: Thu, 3 Oct 2002 16:40:55 -0400

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

Or is there something more advanced that I'm missing here?

Matts

-----Original Message-----
From: owner-rockbox_at_cool.haxx.se [mailto:owner-rockbox_at_cool.haxx.se]On
Behalf Of phil_at_x-phobie.de
Sent: Thursday, October 03, 2002 4:09 PM
To: rockbox_at_cool.haxx.se
Subject: clever algorithm string ->int id wanted


I need an algorithm to calculate a unique id from a string, just
similar to calculating a hash key.
The purpose is that for loading key bindings from a file I want the
user to be able to specify the command by name. That in turn would
mean that I had to keep all the names of all commands in the memory.
What a waste of memory. Thus I'd prefer to identify the commands by an
integer id. While loading the key binding file I could calculate an id
from the command name and then search the appropriate command by id.
Any ideas?

Phil
Received on 2002-10-03

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy