Author: Dieter Buerssner
Date: 15:03:42 06/24/04
Go up one level in this thread
On June 24, 2004 at 09:03:57, Gian-Carlo Pascutto wrote: >On June 24, 2004 at 07:56:32, Anthony Cozzie wrote: >>Switch is _fast_. Again, in assembly: >> >> and eax, 0xF >> jmp table[eax] > >An indirect jmp fast? > >Are you joking? > >Also good luck with getting the compiler to generate that code. I don't understand. My compilers are able to generate fast code for switch. When the cases are "dense" the code will be similar to the code shown by Anthony. The and will probably be not there for typical simple switches. There might be a branch instruction instead (which never will be taken - so it should be perfectly predicted). Eugene has shown, how one can convince MSVC to not issue that branch, either. Regards, Dieter
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.