public List <int> SerializeByFirstGettingIndividualBits() { var output = new List <int>(_bitboard.PopCount()); if (_bitboard.IsEmpty) { return(output); } Bitboard[] list = _bitboard.IndividualBits(); for (int i = 0; i < list.Length; i++) { Bitboard bit = list[i]; int bitIndex = BitUtils.BitScanForward(bit); output.Add(bitIndex); } return(output); }
public int[] Serialize() { var output = new int[PopCount()]; if (IsEmpty) { return(output); } int i = 0; for (ulong x = _bits; x > 0; x &= x - 1) { ulong firstBit = x & (0 - x); int bitIndex = BitUtils.BitScanForward(firstBit); output[i++] = bitIndex; } return(output); }
public List <int> SerializeStandardListLoop() { var output = new List <int>(_bitboard.PopCount()); if (_bitboard.IsEmpty) { return(output); } ulong x = _bitboard; while (x > 0) { ulong firstBit = x & (0 - x); int bitIndex = BitUtils.BitScanForward(firstBit); output.Add(bitIndex); x &= x - 1; } return(output); }
public int[] SerializeStandardArrayLoop() { var output = new int[_bitboard.PopCount()]; if (_bitboard.IsEmpty) { return(output); } int i = 0; ulong x = _bitboard; while (x > 0) { ulong firstBit = x & (0 - x); int bitIndex = BitUtils.BitScanForward(firstBit); output[i++] = bitIndex; x &= x - 1; } return(output); }