[ create a new paste ] login | about

Link: http://codepad.org/yPeZKHkE    [ raw code | output | fork ]

C++, pasted on Dec 13:
U64 Bishop_classical(int indx, U64 blocker)
{
	U64 attacks = 0ULL;

	// North West
	attacks |= RAYS[Direction::NORTH_WEST][indx];
	if (RAYS[Direction::NORTH_WEST][indx] & blocker) {
		unsigned long blockerIndex;
		unsigned char valid = _BitScanForward64(&blockerIndex, RAYS[Direction::NORTH_WEST][indx] & blocker);
		if (valid) {
			attacks &= ~RAYS[Direction::NORTH_WEST][blockerIndex];
		}
	}

	// North East
	attacks |= RAYS[Direction::NORTH_EAST][indx];
	if (RAYS[Direction::NORTH_EAST][indx] & blocker) {
		unsigned long blockerIndex;
		unsigned char valid = _BitScanForward64(&blockerIndex, RAYS[Direction::NORTH_EAST][indx] & blocker);
		if (valid) {
			attacks &= ~RAYS[Direction::NORTH_EAST][blockerIndex];
		}
	}

	// South East
	attacks |= RAYS[Direction::SOUTH_EAST][indx];
	if (RAYS[Direction::SOUTH_EAST][indx] & blocker) {
		unsigned long blockerIndex;
		unsigned char valid = _BitScanReverse64(&blockerIndex, RAYS[Direction::SOUTH_EAST][indx] & blocker);
		if (valid) {
			attacks &= ~RAYS[Direction::SOUTH_EAST][blockerIndex];
		}
	}

	// South West
	attacks |= RAYS[Direction::SOUTH_WEST][indx];
	if (RAYS[Direction::SOUTH_WEST][indx] & blocker) {
		unsigned long blockerIndex;
		unsigned char valid = _BitScanReverse64(&blockerIndex, RAYS[Direction::SOUTH_WEST][indx] & blocker);
		if (valid) {
			attacks &= ~RAYS[Direction::SOUTH_WEST][blockerIndex];
		}
	}
	return attacks;
}


Output:
1
2
3
Line 15: error: use of C99 long long integer constant
Line 1: error: 'U64' does not name a type
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: