Author: Leen Ammeraal
Date: 09:09:27 06/26/01
Go up one level in this thread
Given the fact that there are very
few 1-bits, you might consider something
like this (where 'a' is the given 16-bit
int value):
if (a & 0xFF00)
{ if (a & 0xF000)
...
if (a & 0xF00)
...
}
if (a & 0xFF)
{ if (a & 0xF0)
...
if (a & 0xF)
...
}
In each of the fragments ... only
four bit tests are required and most of
these four fragments will be skipped.
I admit that it is not particularly
elegant, but it may be very fast.
Leen Ammeraal
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.