public static long getCastleMoves(int player, State4 s){
		if(!s.kingMoved[player] && (!s.rookMoved[player][0] || !s.rookMoved[player][1])){
			long moves = 0;
			final long agg = s.pieces[0]|s.pieces[1];
			if(!s.rookMoved[player][0] && (Masks.castleBlockedMask[player][0] & agg) == 0 &&
					!maskIsAttacked(Masks.castleThroughCheck[player][0], 1 - player, s)){
				moves |= Masks.castleMask[player][0];
			}
			if(!s.rookMoved[player][1] && (Masks.castleBlockedMask[player][1] & agg) == 0 &&
					!maskIsAttacked(Masks.castleThroughCheck[player][1], 1 - player, s)){
				moves |= Masks.castleMask[player][1];
			}
			return moves;
		}
		return 0;
	}