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.
Merge remote-tracking branch 'upstream/master'