/*
 * Copyright (C) 2013-2014 Phokham Nonava
 *
 * Use of this source code is governed by the MIT license that can be
 * found in the LICENSE file.
 */
package com.fluxchess.pulse;

/**
 * Bitboard stores squares as bits in a 64-bit long. We provide methods to
 * convert bit squares to 0x88 squares and vice versa.
 */
final class Bitboard {

  long squares = 0;

  static int next(long squares) {
    return toX88Square(Long.numberOfTrailingZeros(squares));
  }

  static long remainder(long squares) {
    assert squares != 0;

    return squares & (squares - 1);
  }

  private static int toX88Square(int square) {
    assert square >= 0 && square < Long.SIZE;

    return ((square & ~7) << 1) | (square & 7);
  }

  private static int toBitSquare(int square) {
    assert Square.isValid(square);

    return ((square & ~7) >>> 1) | (square & 7);
  }

  int size() {
    return Long.bitCount(squares);
  }

  void add(int square) {
    assert Square.isValid(square);
    assert (squares & (1L << toBitSquare(square))) == 0;

    squares |= 1L << toBitSquare(square);
  }

  void remove(int square) {
    assert Square.isValid(square);
    assert (squares & (1L << toBitSquare(square))) != 0;

    squares &= ~(1L << toBitSquare(square));
  }

}

@@ -175,16 +175,108 @@
 pulse;%0A%0A
+import static java.lang.Long.bitCount;%0Aimport static java.lang.Long.numberOfTrailingZeros;%0A%0A
 /**%0A * B
@@ -507,21 +507,16 @@
 8Square(
-Long.
 numberOf
@@ -962,21 +962,16 @@
  return 
-Long.
 bitCount

Add static import in Bitboard