position: support line numbers larger than INT16_MAX (but <= UINT16_MAX) (#553)

This commit is contained in:
akocis 2019-12-27 20:56:50 +01:00 committed by Fangrui Song
parent a2ecd9a8f0
commit e373f9ed97

View File

@ -47,7 +47,7 @@ Range Range::fromString(const std::string &encoded) {
} }
bool Range::contains(int line, int column) const { bool Range::contains(int line, int column) const {
if (line > INT16_MAX) if (line > UINT16_MAX)
return false; return false;
Pos p{(uint16_t)line, (int16_t)std::min<int>(column, INT16_MAX)}; Pos p{(uint16_t)line, (int16_t)std::min<int>(column, INT16_MAX)};
return !(p < start) && p < end; return !(p < start) && p < end;