Mail Archives: djgpp/1997/12/22/09:48:06
"Anthony.Appleyard" <MCLSSAA2 AT fs2 DOT mt DOT umist DOT ac DOT uk> wrote:
> Please reply to me in person, as I had to unsubscribe from djgpp due to email
> intray overload: I will be away from my email over Xmas and New Year.
>
> I have djgpp v2. A program contains a switch(c){ } statement which is obeyed
> very many times. c can be from 0 to 511. How can I make djgpp compile the
> switch() always as a lookup table of labels and not as a lot of time-wasting
> tests and jumps even if the resulting lookup table would be very gappy? I
> can't find anything about this in DJGPP\INFO\ or in the FAQ.
In my editor the commands switch is really huge and gcc automagically makes a
look-up table. The main problem can be if your values are:
1,2,3...100 (gap) 500,501,502...511
Then gcc will make 2 look-up tables and add a little code to use one or the
other.
I think you can't ask for an unconditional look-up table. Anyways, just using
optimizations you get a good ratio of: size needed v.s. speed.
SET
------------------------------------ 0 --------------------------------
Visit my home page: http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Alternative e-mail: set-sot AT usa DOT net - ICQ: 2951574
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013
- Raw text -