Skip to content

Commit

Permalink
Use explicit cast to ptrdiff_t (#267)
Browse files Browse the repository at this point in the history
In RemoveLast, explicitly cast to ptrdiff_t, rather than relying on implicit conversions when skip is called.
  • Loading branch information
MBkkt authored Aug 24, 2022
1 parent 7a40135 commit be91ef2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/s2/util/coding/coder.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class Encoder {

// REQUIRES: length() >= N
// Removes the last N bytes out of the encoded buffer
void RemoveLast(size_t N) { writer().skip(-N); }
void RemoveLast(size_t N) { writer().skip(-static_cast<ptrdiff_t>(N)); }

// REQUIRES: length() >= N
// Removes the last length()-N bytes to make the encoded buffer have length N
Expand Down

0 comments on commit be91ef2

Please sign in to comment.