You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
372 B
16 lines
372 B
4 years ago
|
// +build go1.9
|
||
|
|
||
|
package chess
|
||
|
|
||
|
import "math/bits"
|
||
|
|
||
|
// Reverse returns a bitboard where the bit order is reversed.
|
||
|
func (b bitboard) Reverse() bitboard {
|
||
|
return bitboard(bits.Reverse64(uint64(b)))
|
||
|
}
|
||
|
|
||
|
// Occupied returns true if the square's bitboard position is 1.
|
||
|
func (b bitboard) Occupied(sq Square) bool {
|
||
|
return (bits.RotateLeft64(uint64(b), int(sq)+1) & 1) == 1
|
||
|
}
|