Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: need some help with Java and fast math routines.

Author: scott farrell

Date: 18:27:52 11/28/03

Go up one level in this thread


Thanx Gerd,

It gave a few percent speedup, funny thing is I didnt think of just fiddling
with the current code, I was thinking more of ripping it out, or trying a
non-table based approach.

Here is my final code incase someone looks back on this:

I think the only difference is the l to make the constant an long instead of the
default int, so the compiler doesnt baulk.

Thanx again
Scoot

public static final int msb(long bitboard){
	if (bitboard==0)
		return -1;


    if ( (bitboard & 0xffffffff00000000l) != 0 )
    {
      int w = (int)(bitboard >>> 32);
      if ( (w & 0xffff0000) != 0 )
        return msb_table[w>>>16]+48;
      else
        return msb_table[w]+32;
    }
    else
    { // the lower 32 bit
      int w = (int) bitboard;
      if ( (w & 0xffff0000) != 0 )
        return msb_table[w>>>16]+16;
      else
        return msb_table[w];
    }

}



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.