This is more similar to how get_material_info() and
get_pawn_info() work and also removes some clutter from
evaluate_king().
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This avoid to duplicate storage allocation for every file
where they are used.
Note that simple numeric constant can remain in header because
are automatically folded by the compiler.
Patch suggested by Tord.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Was erroneusly changed with the 32bit in recent
patch "Retire USE_COMPACT_ROOK_ATTACKS...".
Also another clean up of define magics. Move compiler
specific definitions in types.h and remove redundant cruft.
Now this macro ugly mess seems more reasonable.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
On 64 bit systems we can use bsfq instruction to count
set bits in a bitboard.
This is a patch for GCC and Intel compilers to take advantage
of that and get a 2% speed up.
Original patch from Heinz van Saanen, adapted to current tree
by me.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This greatly simplifies bitboard.cpp that now has only two setups,
respectively for 32 and 64 bits CPU according to IS_64BIT define
that is automatically set but can be tweaked manually in
bitboard.h
No functional change both in 32 and in 64 bits.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
We don't need different names between a function and a
template. Compiler will know when use one or the other.
This let use restore original count_1s_xx() names instead of
sw_count_1s_xxx so to simplify a bit the code.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This is what prevented USE_32BIT_ATTACKS from working
on some architectures (like PowerPC).
Merged from Glaurung current development snapshot.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
In this case firstlocates the least valuable attacker, if any,
then proceed as usual.
This will be used by next patch.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Always for 32 bit but withot relying on MSVC intrinsics.
It is very similar to previous ones, but this does not
segfaults due to -fno-strict-aliasing compiler option.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
A bunch of Intel C++ warnings removed, other silent out.
Still few remaining but need deeper look.
Also usual whitespace crap removal noise.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This time we use MSVC intrinsics that are
C wrappers for Intel assembler 'bsf' instruction.
The speed up in node count is around 3%, probably
it does not worth the effort. Anyway this patch
can be useful at least for documentation purposes.
This optimization covers 32 bit systems only.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Under Linux we have a segfault after a random time,
about a couple of minutes while running the benchmark.
This happens both with gcc and icc, and both with O2
and O3 optimizations.
Disable for Linux until we understand what's the deal.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This final version is a little bit faster then
previous patch and is a bit cleaned up also.
On 32 bit x86 pop_1st_bit is now more then
two times faster then the original one that
is optimized for 64 bit processors.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Operations on 64 bits Bitboard types are slow
on x86 compiled with gcc, so optimize this case.
BTW profiling shows that pop_1st_bit() is a
veeery performance critical path!
Signed-off-by: Marco Costalba <mcostalba@gmail.com>