- n = generate_pawn_noncaptures<BLACK>(pos, mlist);
-
- n += generate_piece_moves<KNIGHT>(pos, mlist+n, us, target);
- n += generate_piece_moves<BISHOP>(pos, mlist+n, us, target);
- n += generate_piece_moves<ROOK>(pos, mlist+n, us, target);
- n += generate_piece_moves<QUEEN>(pos, mlist+n, us, target);
- n += generate_piece_moves<KING>(pos, mlist+n, us, target);
- n += generate_castle_moves(pos, mlist+n);
- return n;
+ mlist = generate_pawn_noncaptures<BLACK>(pos, mlist);
+
+ mlist = generate_piece_moves<KNIGHT>(pos, mlist, us, target);
+ mlist = generate_piece_moves<BISHOP>(pos, mlist, us, target);
+ mlist = generate_piece_moves<ROOK>(pos, mlist, us, target);
+ mlist = generate_piece_moves<QUEEN>(pos, mlist, us, target);
+ mlist = generate_piece_moves<KING>(pos, mlist, us, target);
+ mlist = generate_castle_moves(pos, mlist);
+ return int(mlist - mlist_start);