Skip to content

Commit

Permalink
Convert TT depth to int8_t
Browse files Browse the repository at this point in the history
Now that half plies have been removed from the engine, we can encode
TT depth into an int8_t.

Range is -128 to +127, so it goes still further than the previous
limit of 121 plies (with ONE_PLY == 2 where depth - DEPTH_NONE was
encoded as an uint8_t).

No functional change.

Resolved #60
  • Loading branch information
lucasart authored and zamar committed Oct 1, 2014
1 parent a1b62d6 commit e60cdca
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tt.h
Expand Up @@ -38,7 +38,7 @@ struct TTEntry {
Move move() const { return (Move )move16; }
Value value() const { return (Value)value16; }
Value eval_value() const { return (Value)evalValue; }
Depth depth() const { return (Depth)(depth8) + DEPTH_NONE; }
Depth depth() const { return (Depth)depth8; }
Bound bound() const { return (Bound)(genBound8 & 0x3); }

private:
Expand All @@ -51,15 +51,15 @@ struct TTEntry {
value16 = (int16_t)v;
evalValue = (int16_t)ev;
genBound8 = (uint8_t)(g | b);
depth8 = (uint8_t)(d - DEPTH_NONE);
depth8 = (int8_t)d;
}

uint16_t key16;
uint16_t move16;
int16_t value16;
int16_t evalValue;
uint8_t genBound8;
uint8_t depth8;
int8_t depth8;
};

/// TTCluster is a 32 bytes cluster of TT entries consisting of:
Expand Down

3 comments on commit e60cdca

@mstembera
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's nice not to have to and and subtract DEPTH_NONE all the time. Why change from unsigned to signed though? Depth is never negative correct?

@mstembera
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duh. Never mind. Clearly depth IS negative sometimes.

@lucasart
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • depth is negative in the qsearch.
  • here we use ttDepth, not depth (see qsearch). still can be negative (but cannot be less than -1).

Please sign in to comment.