PKHeX/PKHeX.Core/Moves/MoveInfo8b.cs
Kurt 65bc027f22 Improve perf of dummied move check
O(1) of a not-allocated array is faster than O(1) of an allocated HashSet.
2023-10-29 20:25:23 -07:00

31 lines
1.4 KiB
C#

using System;
namespace PKHeX.Core;
/// <summary>
/// Details about moves in <see cref="EntityContext.Gen8b"/>
/// </summary>
internal static class MoveInfo8b
{
/// <summary>
/// Bitflag indexes of moves that are not usable in game.
/// </summary>
/// <remarks>
/// This is a bitflag array, where each bit represents a move. If the bit is set, the move is not usable in game.
/// Instead of allocating a hashset, this is a more efficient method (no allocation) with O(1) lookup (faster than HashSet's O(1) lookup).
/// </remarks>
public static ReadOnlySpan<byte> DummiedMoves => new byte[] // 314 moves (628 bytes) => 104 bytes.
{
0x1C, 0x20, 0x00, 0x0C, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00,
0x04, 0x00, 0x09, 0x00, 0xA1, 0x22, 0x19, 0x10, 0x26, 0xC0,
0x00, 0x0A, 0x00, 0x02, 0x02, 0x00, 0x00, 0x45, 0x10, 0x00,
0x00, 0x00, 0x00, 0x02, 0x04, 0x80, 0x26, 0x70, 0x00, 0x50,
0x91, 0x00, 0x00, 0x04, 0x60, 0x08, 0x20, 0x67, 0x04, 0x00,
0x00, 0x00, 0x00, 0x24, 0x00, 0x28, 0x00, 0x01, 0x04, 0x20,
0x22, 0x00, 0x04, 0x18, 0xD0, 0x81, 0xB8, 0xAA, 0xFF, 0xE7,
0x8B, 0x0E, 0x45, 0x98, 0x07, 0xCB, 0xE4, 0xE3, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xA7, 0x74, 0xEB, 0xAF, 0xFF, 0xB7, 0xF7,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0x7F, 0xFF,
0xFF, 0xFF, 0xFF, 0x07,
};
}