LCOV - code coverage report
Current view: top level - Source - pieceTools.hpp (source / functions) Coverage Total Hit
Test: coverage Lines: 100.0 % 7 7
Test Date: 2026-03-02 16:42:41 Functions: - 0 0

            Line data    Source code
       1              : #pragma once
       2              : 
       3              : #include "position.hpp"
       4              : 
       5              : namespace PieceTools {
       6              : [[nodiscard]] FORCE_FINLINE Piece getPieceIndex_(const Position &p, const Square k) {
       7              :    assert(isValidSquare(k));
       8        39962 :    const Piece pp = p.board_const(k);
       9        39962 :    assert(isValidPiece(pp));
      10              :    return (Piece)PieceIdx(pp);
      11              : }
      12              : [[nodiscard]] FORCE_FINLINE Piece getPieceType(const Position &p, const Square k) {
      13     19429727 :    assert(isValidSquare(k));
      14     39173542 :    const Piece pp = p.board_const(k);
      15     39173542 :    assert(isValidPiece(pp));
      16     39173542 :    return Abs(pp);
      17              : }
      18              : [[nodiscard]] FORCE_FINLINE std::string_view getName(const Position &p, const Square k) {
      19              :    assert(isValidSquare(k));
      20        39962 :    return PieceNames[getPieceIndex_(p, k)];
      21              : }
      22              : [[nodiscard]] FORCE_FINLINE std::string_view getNameUTF(const Position &p, const Square k) {
      23              :    assert(isValidSquare(k));
      24              :    return PieceNamesUTF[getPieceIndex_(p, k)];
      25              : }
      26              : /*
      27              : [[nodiscard]] FORCE_FINLINE ScoreType getValue(const Position &p, Square k) {
      28              :    assert(isValidSquare(k));
      29              :    return Values[getPieceIndex_(p, k)];
      30              : }
      31              : */
      32              : [[nodiscard]] FORCE_FINLINE ScoreType getAbsValue(const Position &p, const Square k) {
      33              :    assert(isValidSquare(k));
      34              :    return Abs(Values[getPieceIndex_(p, k)]);
      35              : }
      36              : } // namespace PieceTools
        

Generated by: LCOV version 2.0-1