1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00
Commit graph

30 commits

Author SHA1 Message Date
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
9fc602bae7 Updated copyright year to 2010
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2010-03-20 11:27:07 +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
f3d0b76feb Use optimized pop_1st_bit() under Windows 64 with icc
Intel compiler can handle this code even under Windows.

So lift the costrain.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-08-14 12:47:49 +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
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
3e40bd0648 Introduce do_move_bb() to update bitboards after a move
Avoid a clear_bit() + set_bit() sequence but update bitboards
with only one xor instructions.

This is faster and simplifies the code.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-05-21 10:55:23 +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
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
c32904f0a0 Revert previous commit.
Optimization is correct but slightly slower
so it is a pessimization :-)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-02-04 19:40:09 +01:00
Marco Costalba
6cfb661ca5 Yet another count_1s() optimization
No functional change

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-01-25 19:29:15 +01:00
Marco Costalba
be43219136 Rever count_1s() optimizations
They are wrong for all ones case.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-01-25 18:00:57 +01:00
Marco Costalba
3e6e57231e Rewrite count_1s() to be similar to 64bit counterpart
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-01-11 17:15:18 +01:00
Marco Costalba
14c1fd4d27 Micro optimize count_1s_max_15() for 32 bit system
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-01-11 17:05:29 +01:00
Marco Costalba
389dc0e83b Add behind_bb() helper to simplify code logic
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-10 00:14:24 +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
74f1efee26 Manual merge 2008-10-26 21:44:58 +01:00
Marco Costalba
af59cb1d63 Refactor Position::pinned_pieces() to use templates
Also better document this interesting function.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-24 21:10:04 +02:00
Marco Costalba
279ed7ed48 Quiet a warning on Intel compiler
Plus usual trailing whitespace noise.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-20 21:55:43 +02: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
d3600c39a7 Update copyright info
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-19 20:43:33 +01:00
Marco Costalba
d6618d7325 Add auto configuration for 32/64 bits
Instead of manually adjust defines in bitboard.h
now proper ones are automatically set.

It is anyhow possible to still set them manually
in case of problems.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-25 07:51:56 +02:00
Marco Costalba
bb751d6c89 Initial import of Glaurung 2.1 2008-09-01 07:59:13 +02:00