I'm creating a Chess Solver and have decided to use bitboards. Conveniently there are 64 squares on a standard chess board. This is nice since the prevalence of 64-bit operating systems a single bitboard can fit into a single register.
That said, are there fundamental differences (size (memory and code), speed, complexity, memory usage, etc) in using a std::bitset<64>
and the functions therein or the fundamental type of the "same" size unsigned long long
and performing the bit twiddling manually?
uint64_t
probably. You'll want to perform operations that are not available on std::bitset
, including almost all arithmetic operations, bitscan, using parts of the board as index into an array, and SSE intrinsics if you get serious about it.
For example (not an exhaustive list by any means, just some simple examples) in o^(o-2r) (and its cousin), the more advanced Hyperbola Quintessence, as part of extracting the lowest set bit, etc.
You could use std::bitset
but you'd be converting it back to some type of integer a lot.