1
0
Fork 0
Commit Graph

201 Commits (riscv64-cartesi)

Author SHA1 Message Date
Marco Costalba 5f5d056c8f Replace make_square() with operator|(File, Rank)
Be fancy :-)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-06-23 09:17:54 +01:00
Marco Costalba 9793fa1906 Calculate min distance between king and his pawns
Just added infrastructure.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-06-17 09:41:18 +01:00
Marco Costalba 0446fc85de Reformat pick_random() in magics calculation
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-06-10 11:46:52 +01:00
Marco Costalba 2f47844c7c Simplify attacks_bb()
And some formatting while there.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-05-01 13:16:20 +01:00
Marco Costalba f59323b56a Use more_than_one() instead of single_bit()
It is more correct given what the function does. In
particular single_bit() returns true also in case of
empty bitboards.

Of course also the usual renaming while there :-)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-04-14 09:51:59 +01:00
Marco Costalba 797c960d20 Rewrite pop_1st_bit() to be endian independent
With this change sources are fully endianess
independent, so we can simplify the Makefile.

Somewhat surprisingly we don't have any speed
regression !

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-04-06 12:38:27 +01:00
Marco Costalba 37fa8adc2b Micro-optimize last_1() for 32bits
Verified assembly it is a bit simpler.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-04-04 06:54:48 +01:00
Marco Costalba 6e00aa6bae Better document square flipping helpers
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-04-01 11:30:54 +01:00
Marco Costalba 9bbd27a80f Introduce Bitboards namespace
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-04-01 11:01:13 +01:00
Marco Costalba 76622342ec Restore MS1BTable[]
Incredible typo from my side!

The 2 tables are completely different, one counts 1s the
other returns the msb position. Even more incredible
the 'stockfish bench' command returns the same number
of nodes!!!

Spotted by Justin Blanchard.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-03-28 19:11:37 +01:00
Marco Costalba 46a50cbf38 Replace MS1BTable[] with BitCount8Bit[]
We already have the necessary infrastructure
in place.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-03-28 14:08:19 +01:00
Gary Linscott 374c9e6b63 Add more detailed pawn shelter/storm evaluation 2012-03-26 07:52:10 -04:00
Marco Costalba 3b906ffc27 Micro-optimize pop_1st_bit() for 32 bits
Small perft speed-up of 2% and also a code
simplification.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-02-13 10:07:09 +01:00
Marco Costalba 7b4b65d7a9 Templetize sliding attacks
No functional change and no speed regression, it seems
to be even a bit faster on MSVC and gcc.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-02-13 09:15:55 +01:00
Marco Costalba 099b5e45e6 Speedup sliders attacks for 32bit CPU
Replace a 64 bit 'and' by two 32 bits ones and
use unsigned instead of int.

This simple patch increases perft speed of 6% on
my Intel Core 2 Duo !

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-02-12 15:26:18 +01:00
Marco Costalba a492a9dd07 Bitwise operator overloads between Bitboard and Square
Yes, we try to be fancy here ;-)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-01-29 10:59:50 +01:00
Marco Costalba 875a8079bc Replace clear_bit() with xor_bit()
This allows to retire ClearMaskBB[] and use just
one SquareBB[] array to set and clear a bit.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-01-29 09:38:40 +01:00
Marco Costalba dfd030b67a Make init_magic() piece agnostic
All the piece dependant data is passed now as
function arguments so that the code is exactly
the same for bishop and rook.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-01-15 09:21:00 +01:00
Marco Costalba 2aec8fb956 Retire queen_attacks_bb()
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-01-14 23:00:10 +01:00
Marco Costalba 3ec94abcdb Use 'adjacent' instead of 'neighboring'
It is more correct and specific. Another naming
improvement while reading Critter sources.

No functional changes.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-01-14 18:04:13 +01:00
Marco Costalba b05fbb3733 Unify PseudoAttacks arrays
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-01-09 22:08:37 +01:00
Marco Costalba 6482ce2bb2 Fix compile on HP-UX 11's HP's C++
On that platform non-bracketed casting are not supported.

Reported by Richard Lloyd.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2012-01-07 00:04:08 +01:00
Marco Costalba e9296d694c Unify BitCountType selection
Now that HasPopCnt is a compile time constant we can
centralize and unify the BitCountType selection.

Also rename count_1s() in the more standard popcount()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-12-31 10:46:14 +01:00
Marco Costalba 8307da0de7 Update copyright year to 2012
And refresh Readme.txt while there.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-12-30 13:52:16 +01:00
Marco Costalba 0a6532a39d Retire run-time detection of hardware POPCNT
It was meant to build a single binary optimized
for any kind of CPU: with and without hardware POPCNT.

This is a nice idea but in practice was never used, or
people builds binary with popcnt enabled or not, mainly
according to their type of CPU. And it was also never
used in the official Jim's builds where, in case, would
be easier for a number of reasons, do build two different
versions: with and without SEE42 support.

So retire this feature and simplify the code.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-12-30 12:17:03 +01:00
Marco Costalba ad4739a6d4 Retire SquaresByColorBB[] and enum SquareColor
Use same_color_squares() instead.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-12-28 10:57:08 +01:00
Marco Costalba a44c5cf4f7 Prefer 0 to EmptyBoardBB
Easier and even faster or at least easier to optimize.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-12-03 12:02:13 +01:00
Marco Costalba 5c5af4fa65 Retire neighboring_files_bb() overload
Rarely used and we prefer to not hide the complexity.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-12-03 11:58:55 +01:00
Marco Costalba 22b9307aba Further touches to magic bitboards code
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-11-01 10:38:01 +01:00
Marco Costalba 90890844ad Document magics bitboards code
Add comments and rename stuff to better clarify what the
magic bitboard initialization code does.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-10-31 18:57:13 +01:00
Alexander Kure 5c8af7ccb8 Replaced macros Min() and Max() with corresponding STL algorithms std::min() and std::max() 2011-10-31 00:38:44 -04:00
Marco Costalba c2c185423b Better naming borrowed from Critter
In line with http://chessprogramming.wikispaces.com conventions.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-10-02 10:16:59 +01:00
Marco Costalba b706165527 Lookup square distance instead of calculate on the fly
Microptimization that gives a +0.7% speed increase.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-09-11 10:11:43 +01:00
Marco Costalba fe26967ea0 Simplify sliding_attacks()
Easy, almost trivial simplification, I don't understand
how I missed this before !!

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-06-21 19:01:00 +01:00
Marco Costalba 4c9d570e43 Use Carry-Rippler trick to speed up magics
Nice trick discovered on:

http://chessprogramming.wikispaces.com/Traversing+Subsets+of+a+Set

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-06-15 02:15:41 +01:00
Marco Costalba b3a0b389d2 Better self-document init_zobrist()
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-06-12 11:50:19 +01:00
Marco Costalba 47959c56fd Fix initialization of BSFTable[]
We should start from i = 0, it works by accident because
static storage BSFTable[] is init to zero by default.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-06-12 11:37:02 +01:00
Marco Costalba bc4f3155ae Better document move_to_san()
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-06-10 11:59:53 +01:00
Marco Costalba b414fc0dfd Use double rotate for magic generation
Allow to choose among 4096 instances of pseudo-random
sequences instead of the previous 64 so the probability
to find a better sequence increases and actually we have
a much better 64 bit case and we can also use the 64 bit
version of pick_magic() also for 32 bits and althoug sub
optimal, because now we can have more choices results are
even slightly better also for 32 bit.

Use also a faster submask().

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-06-09 18:47:58 +01:00
Marco Costalba 3dfff5bdae Small pick_magic() touches
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-06-08 17:59:47 +01:00
Marco Costalba d632e77058 Find magics on the fly
Good result for 32 bit case where computation is very fast,
still not satisfying on 64 bit case where the magics seem
a bit harder to get.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-06-07 20:59:12 +01:00
Marco Costalba 6d665b7f78 Partially revert previous patches
Due to a -2% speed penalty. This patch takes the best
of the previous series without the regression due to
introduction of Magic struct.

Speedup against previous revision is of almost 3% !!!!

No functional change both in 32 and 64 bits.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-06-06 11:56:17 +01:00
Marco Costalba b1b0c64046 Skip offset calculation in slider attacks
Another small simplification and micro optimization.

No functional change in both 32 and 64 bits.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-06-05 15:01:22 +01:00
Marco Costalba 670cee44f0 Get rid of Shift[] tables
We can calculate them counting the masks bits.

Also small tweak to sliding_attacks()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-06-05 14:13:41 +01:00
Marco Costalba 3092f0c646 Better name and document magic botboard stuff
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-06-05 12:28:36 +01:00
Marco Costalba 2f6142cb9b Try to keep memory access in the same cache line
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-06-05 12:27:53 +01:00
Marco Costalba 91407f4f74 Move bitboards initializations under one function
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-06-04 11:05:12 +01:00
Marco Costalba 025d57855a Calculate Bit Scan tables at initialization
Instead of hard-coding them.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-06-04 09:59:18 +01:00
Marco Costalba 09d217bff7 Reintroduce initialization of some bitboards
With off-by-one bug in InFrontBB[] loop fixed.

Also use int instead of File to workaround a bug
in mingw 4.4.0 in first loop that cycles forever.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-03-10 19:23:39 +01:00
Marco Costalba d9113d127b Rename NonSlidingAttacksBB[] in StepAttacksBB[]
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-03-10 08:10:26 +01:00
Marco Costalba d85cf6d9c3 Revert previous patch due to miscompile under gcc
I need to understand what's going on, in the
meantime revert.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-03-10 08:08:04 +01:00
Marco Costalba a617b03875 Change initialization of some bitboards
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-03-08 19:44:19 +01:00
Marco Costalba deb212cb05 Retire enum SquareDelta
Use Square instead. At the end is the same because we were
anyway foreseen operators on mixed terms (Square, SquareDelta).

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-02-23 18:41:35 +01:00
Marco Costalba 69726f4df3 Remove defined(IS_64BIT) in init_sliding_attacks()
No functional change bith in 32 and 64 bits.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-29 14:06:29 +01:00
Marco Costalba 59c85346d2 Small cleanup in init_sliding_attacks()
No functional change both in 32 and 64 bits.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-19 19:50:44 +01:00
Marco Costalba e8f885145b Numbers formatting in bitboard.cpp
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-19 19:50:32 +01:00
Marco Costalba 4f3fe89fb6 Retire RelativeRankBB[]
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-19 13:33:38 +01:00
Marco Costalba be5b32bb9c Another round of bitboard.cpp cleanups
Also renamed StepAttackBB[] in NonSlidingAttacksBB[]

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-04 11:12:31 +01:00
Marco Costalba deee18c758 Another (final?) attempt at squares_delta()
This time I have removed the function alltogether !

Sorry to work above a patch of UncombedCoconut (Justin Blanchard)
but I couldn't resist ;-)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-02 11:52:51 +01:00
Marco Costalba 57c51dd1ef Simplify squares_delta()
And rename in ray_direction()

Patch from UncombedCoconut.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2011-01-02 10:59:08 +01:00
Marco Costalba e7ab3a0d16 Retire DirectionTable[]
With this patch even word 'direction' is disappeared !

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-12-27 03:08:10 +01:00
Marco Costalba 4dded4e72f Retire direction.cpp
Move the code to bitboard.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-12-26 16:51:21 +01:00
Marco Costalba cb7f20913e Retire enum Direction
Use SquareDelta instead

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-12-26 16:17:51 +01:00
Marco Costalba f08a6eed0d Retire SignedDirectionTable[] and RayBB[]
Function ray_bb() was used just in one endgame where can
be used squares_in_front_of() instead.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-12-26 12:12:58 +01:00
Marco Costalba 6080fecf9c Retire direction.h
Move all to square.h

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-12-26 10:58:52 +01:00
Marco Costalba 7733dadfd7 Small codestyle touches
Mostly suggested by Justin (UncombedCoconut), the 0ULL -> 0 conversion
is mine.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-10-09 13:05:58 +01:00
Marco Costalba d4876dc963 Rewrite bit counting functions
Get rid of macros and use templates instead,
this is safer and allows us fix the warning:

ISO C++ forbids braced-groups within expressions

That broke compilation with -pedantic flag under
gcc and POPCNT enabled.

No functional and no performance change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-10-04 18:40:44 +01:00
Marco Costalba 14f059072a Introduce enum SquareColor
Square and piece colors are two different things,
so use different types to avoid misunderstandings.

Suggested by Tord.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-07-25 11:49:58 +01:00
Marco Costalba 5212995563 Retire bitScanReverse32()
Use log() instead because we are not in speed
critical paths.

Also a bit of renaming and code shuffle while there.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-06-01 21:58:54 +01:00
Marco Costalba 0c9c5032e8 Rename OutpostMask[] in AttackSpanMask[]
This is a more standard naming (see chessprogramming wiki)
and is more stick to what table is and not what is used for.

Code in pawns.cpp is a bit more readable now, at least for me ;-)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-05-14 16:55:35 +01:00
Marco Costalba 1f1ef0897c Introduce table SquaresInFrontMask[2][64]
It will be used to lookup squares in front of
a given square. Same concept of PassedPawnMask[]
and OutpostMask[].

Also small tweaks in bitboard.h

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-04-18 09:47:31 +01:00
Marco Costalba 87379c2929 Space inflate bitboard.cpp
This file, somehow, avoided the "space inflate" treatment...until now ;-)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-04-18 08:58:26 +01:00
Marco Costalba 9fc602bae7 Updated copyright year to 2010
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-03-20 11:27:07 +01:00
Marco Costalba 0f39e5c4ff Fix a little warning under gcc compiler
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-12-30 13:25:22 +01:00
Marco Costalba 990d83a72d Optimized bitScanReverse32()
Should be a bit faster then previous one.
Hacked by Pascal Georges.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-12-30 13:25:21 +01:00
Marco Costalba 3f14f9a478 Revert small pop_1st_bit() optimization
We cannot cast a pointer type to an unrelated pointer type.
This is a violation of the strict aliasing rules.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-12-27 14:07:08 +01:00
Marco Costalba c52da3b806 Logaritmic futility margins
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-11-23 20:59:24 +01:00
Marco Costalba 8a116ce691 Small update to pop_1st_bit()
Avoid a 64 bit load using a pointer. It saves a couple of push/pop
instructions so advantage is only theorical, but anyway we use
pop_1st_bit() as a reference implementation for 32 bit systems so
we keep it more for documentation purposes then for other reasons.

Idea of pointer is of Eric Mullins.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-11-10 17:18:00 +01:00
Marco Costalba dc286d2673 Big-endian compatible pop_1st_bit()
Thanks to Eric Mullins we have now endian friendly
pop_1st_bit() and also is removed the need to use
-fno-strict-aliasing compiler option with GCC.

Speed is almost as fast, very small difference if any in
perft test, so I assume almost no difference in real games.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-11-06 10:21:15 +01:00
Marco Costalba d1d4437699 Remove a local variable from pop_1st_bit()
Remove the 'b' uint32_t local variable.
Optimized assembly is more or less the same
(one 'mov' instruction less), but now it is
written in a way more similar to the final assembly
flow so it should be easier for compiler to optimize.

Also guarantee that BitTable[] is always aligned.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-08-23 18:55:07 +01:00
Marco Costalba 080a4995a3 Simplify king shelter cache handling
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>
2009-07-24 14:13:13 +01:00
Marco Costalba b3b1d3aaa7 Move constant bitboard arrays from header to cpp file
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>
2009-07-17 16:25:53 +01:00
Marco Costalba 5d79af9e0d Restore correct 64 bit version of pop_1st_bit()
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>
2009-07-03 10:18:20 +02:00
Marco Costalba a87ea9846d Use bsfq asm instruction to count bits
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>
2009-07-03 10:18:14 +02:00
Marco Costalba 063e2441b1 Retire USE_COMPACT_ROOK_ATTACKS and USE_FOLDED_BITSCAN defines
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>
2009-07-03 07:52:10 +01:00
Marco Costalba 76024ac40e Use compiler name lookup to simplify code
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>
2009-05-24 10:18:31 +01:00
Marco Costalba f90f810ac4 Enable _BitScanForward64 at runtime
Only add infrastructure, still disabled.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-05-24 09:46:43 +01:00
Marco Costalba 3376c68f4b Introduce bitcount.h
It will be used for POPCNT intrinsics.

For now no bianry and functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-05-21 16:19:20 +02:00
Marco Costalba 9c428afb6d Fix a warning un using anonymous structs
No functional and no binary change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-05-12 12:10:40 +02:00
Marco Costalba 5c81602d14 Update copyright year
We are well in 2009 already.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-05-07 14:54:40 +02:00
Marco Costalba 0e835bd334 Fixed a sliding attack bitboard bug in 32-bit mode
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>
2009-03-24 10:30:27 +01:00
Marco Costalba 74160ac602 Big headers cleanup
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-19 12:55:32 +01:00
Marco Costalba aaad48464b Add a see() function that take only destination square
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>
2008-12-10 00:13:59 +01:00
Marco Costalba 5dc2312121 Update copyright info
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-20 21:47:20 +02:00
Marco Costalba 3901affb1d Yet another pop_1st_bit() optimization
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>
2008-10-12 14:34:54 +02:00
Marco Costalba 7dd0c39714 Warnings termination fest
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>
2008-09-24 00:32:53 +02:00
Marco Costalba 2a3ebc884e Optimize pop_1st_bit() take 2
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>
2008-09-21 22:19:07 +02:00
Marco Costalba 29b01b6d82 Use optimized pop_1st_bit() only under Windows
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>
2008-09-20 22:19:54 +02:00
Marco Costalba 1373a00187 Final touches to pop_1st_bit optimization
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>
2008-09-19 05:33:55 +02:00
Marco Costalba 9ae2b69235 Optimize pop_1st_bit() on 32 bits x86
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>
2008-09-18 16:09:19 +02:00
Marco Costalba bb751d6c89 Initial import of Glaurung 2.1 2008-09-01 07:59:13 +02:00