Skip to content

Commit

Permalink
Clarify asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Jun 29, 2022
1 parent c3d7add commit af6425a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions test/state/mpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ struct Path

[[nodiscard]] Path tail(size_t pos) const noexcept
{
assert(pos <= length);
assert(pos > 0); // Usage in MPT should never request whole path copy.
assert(pos > 0 && pos <= length); // MPT never requests whole path copy (pos == 0).
Path p;
p.length = length - pos;
std::copy_n(&nibbles[pos], p.length, p.nibbles);
Expand All @@ -43,8 +42,7 @@ struct Path

[[nodiscard]] Path head(size_t size) const noexcept
{
assert(size <= length);
assert(size != length); // Usage in MPT should never request whole path copy.
assert(size < length); // MPT never requests whole path copy (size == length).
Path p;
p.length = size;
std::copy_n(nibbles, size, p.nibbles);
Expand Down

0 comments on commit af6425a

Please sign in to comment.