Search code examples
phpmysqlchess

How to store 64bit number (bitboard)


I wanted to play around with bitboards for presenting a chessgame. For presenting a chessgame, i need at least 12, but preferable 14 bitboards with values like:

00000000 00000000 00000000 00000000 00000000 00000000 11111111 11111111

What kind of datatype needed here? I thought i could save it as a biginteger but then i converts to a numerical value?


Solution

  • You can use the BIT type to store bit fields.

    The type BIT(14) will store a field of 14 bits. You write to these fields using the notation b'01001'.