[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Userdata with methods *and* table access.
- From: leiradella@...
- Date: Thu, 14 Oct 2004 14:26:33 -0400 (EDT)
- Date-warning: Date header was inserted by mgate.usa.xerox.com
Mail from: From: leiradella@bigfoot.com
> This will only produce a tiny improvement, but switch is your friend:
>
> if (key[0] != '\0')
> {
> switch (key[0] | (key[1] << 8))
> {
> case 'x':
> /* do X thing */
> break;
>
> case 'y':
> /* do Y thing */
> break;
> }
> }
Depending on how many keys one have to compare and their difference in
length, gperf (http://www.gnu.org/software/gperf/gperf.html) can also be a
good friend.
Andre de Leiradella