@@ 135,7 135,7 @@ pub fn maskBishopOccupancy(bishop: Square) u64 {
}) {
bitboard |= @as(u64, 1) << (8 * r + f);
}
- return resetBit(bitboard, bishop);
+ return unsetBit(bitboard, bishop);
}
/// Given a square occupied by a rook, return a bitboard of relevant occupancy
@@ 163,7 163,7 @@ pub fn maskRookOccupancy(rook: Square) u64 {
while (f <= 6) : (f += 1) {
bitboard |= @as(u64, 1) << (8 * r + f);
}
- return resetBit(bitboard, rook);
+ return unsetBit(bitboard, rook);
}
// Given a square occupied by a bishop and a bitboard of potentially blocking
@@ 171,7 171,7 @@ pub fn maskRookOccupancy(rook: Square) u64 {
// the ray hits a block. The attack ray includes the blocking square.
pub fn bishopAttackRays(bishop: Square, block: u64) u64 {
const sq = @enumToInt(bishop);
- const block_minus_sq = resetBit(block, bishop);
+ const block_minus_sq = unsetBit(block, bishop);
const rank = @intCast(i8, sq / 8);
const file = @intCast(i8, sq % 8);
var bitboard: u64 = 0;
@@ 215,7 215,7 @@ pub fn bishopAttackRays(bishop: Square, block: u64) u64 {
bitboard |= bit;
if (bit & block_minus_sq != 0) break;
}
- return resetBit(bitboard, bishop);
+ return unsetBit(bitboard, bishop);
}
// Given a square occupied by a rook and a bitboard of potentially blocking
@@ 223,7 223,7 @@ pub fn bishopAttackRays(bishop: Square, block: u64) u64 {
// the ray hits a block. The attack ray includes the blocking square.
pub fn rookAttackRays(rook: Square, block: u64) u64 {
const sq = @enumToInt(rook);
- const block_minus_sq = resetBit(block, rook);
+ const block_minus_sq = unsetBit(block, rook);
const rank = @intCast(i8, sq / 8);
const file = @intCast(i8, sq % 8);
var bitboard: u64 = 0;
@@ 252,7 252,7 @@ pub fn rookAttackRays(rook: Square, block: u64) u64 {
bitboard |= bit;
if (bit & block_minus_sq != 0) break;
}
- return resetBit(bitboard, rook);
+ return unsetBit(bitboard, rook);
}
pub const num_rook_relative_occupancies = numRookRelativeOccupancies();
@@ 294,7 294,7 @@ fn subOccupancy(blockMask: u64, i: u64) u64 {
while (count < blockBitCount) : (count += 1) {
var lsbIndex = @intCast(u6, @ctz(u64, mask));
- mask = resetBit(mask, @intToEnum(Square, lsbIndex));
+ mask = unsetBit(mask, @intToEnum(Square, lsbIndex));
if (i & (@as(u64, 1) << count) != 0) {
occupancy |= @as(u64, 1) << lsbIndex;
@@ 77,7 77,7 @@ pub fn bitboardFromSquares(squares: []const Square) u64 {
return setBits(@as(u64, 0), squares);
}
-pub fn resetBit(bitboard: u64, square: Square) u64 {
+pub fn unsetBit(bitboard: u64, square: Square) u64 {
const mask = @as(u64, 1) << @enumToInt(square);
return if (getBit(bitboard, @enumToInt(square)))
bitboard ^ mask