[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: my Bidi implementation
- To: Development Discussions <developer at arabeyes dot org>
- Subject: Re: my Bidi implementation
- From: Behdad Esfahbod <behdad at cs dot toronto dot edu>
- Date: Sat, 13 Mar 2004 17:34:43 -0500
On Sat, 13 Mar 2004 dov at imagic dot weizmann dot ac dot il wrote:
> It just shows how detached I am from the code these days. ;-) I
> should be more careful with you on the list.
>
> Finding the *optimal* 9 layer lookup sounds like a really tough
> optimization problem. I guess I'll have a look at the code to
> see what you did. It would be even more interesting finding the
> optimal combination between "if"-statements and lookups
> automatically. But I'm getting carried away.
>
> Dov
It's a backtrack, optimized with a couple of bounds. It used to
take a minute to find that, but right now on my laptop, it took
less than 10 seconds. There is no "if" statement, just a simple
lookup. Looks like this:
#define FRIBIDI_GET_TYPE(x) \
FriBidiPropertyBlockLevel8[(x)%2 + \
FriBidiPropertyBlockLevel7[(x)/2%2 + \
FriBidiPropertyBlockLevel6[(x)/4%8 + \
FriBidiPropertyBlockLevel5[(x)/32%2 + \
FriBidiPropertyBlockLevel4[(x)/64%4 + \
FriBidiPropertyBlockLevel3[(x)/256%8 + \
FriBidiPropertyBlockLevel2[(x)/2048%4 + \
FriBidiPropertyBlockLevel1[(x)/8192%8 + \
FriBidiPropertyBlockLevel0[(x)/65536]]]]]]]]]
cool? ;)
behdad