Rename castling flag to castling right

This is a more conventional naming as
reported also in:

http://chessprogramming.wikispaces.com/Castling+rights

No functional change.
Retire SERIALIZE macros

Explicitly write the 'while' loops. This adds some
code but makes clear what's the code behind the
macro.

No functional change.
Simplify generate<EVASIONS>

No speed regression, tested with both perft and
bench.

No functional change.
Simplify pseudo_legal()

Big simplification of pawn move check.

Code has been tested with a brute force approach: for
every position reached during a bench search, the function
has been called for each combinations of Move(from, to)
and verified the result is the same of old code.

Actually this function is very critical becuase is the
one that ensures corrupted TT moves are discarded, so
to properly test it a simple bench is not enough.

Verified also speed is not changed.

No functional chnage.
Print dbg counters after bench

Print last debug counters update just
before to exit benchmark.

Suggested by Stephane Nicolet.

No functional change.
Small simplification in gives_check

Use switch statement also for normal case.

No speed regression.

No functional change.
Use std::count in pos_is_ok()

No functional change.
Merge hash key computation functions

No functional change.
Further merge StateInfo setup functions

No functional change.
Reformat do_castling()

No functional change.
Re-add link time optimization on OS X

In the new version of clang, -O4 does not imply -flto, so we set the
flag
Further work in pos_is_ok()

No functional change.
Use legal positions for endgame initialization

During endgame initialization we get the material
hash key of each endgame forging and ad-hoc position
that in same cases is illegal (leaves teh king under
capture). This is not a problem for the material key,
but rises an assert when SF is run in debug mode with
'testKingCapture' set in pos_is_ok().

So rewrite the code to always produce legal positions.

No functional change.
Depth dependant aspiration window delta

Split delta value in aspiration window so that when
search depth is less than 24 a smaller delta value
is used. The idea is that the search is likely to
be more accurate at lower depths and so we can exclude
more possibilities, 25% to be exact.

Passed STC
LLR: 2.96 (-2.94, 2.94) [-1.50, 4.50]
Total: 20430 W: 3775 L: 3618 D: 13037

And LTC
LLR: 2.96 (-2.94, 2.94) [0.00, 6.00]
Total: 5032 W: 839 L: 715 D: 3478

Bench: 7451319
Microptimize castling in undo_move()

We don't need to set 'captured' and 'pt' after we
castle back.

No functional change.
Merge default tests in pos_is_ok

No functional change.
Remove "Max Threads per Split Point" UCI option

Experimental patch to verify if drop of nps
in endgames at very long TC is due to this.

Suggested by Ronald de Man.

bench: 7451319
Split also if no slaves are found

Because we test for available slaves before
entering split(), we almost always allocate a
slave, only in the rare case of a race (less
then 2% of cases) this is not true, but to
special case this occurrence is not worth
the added complexity.

bench: 7451319
Fix a crash under MSVC

Using memset on a std::vector is undefined behavior,
so manually init all the data memebers of LimitsType.

Bug intorduced in 41641e3b1eea0038ab6984

No functional change.
Merge branch 'master' into cutNode1