(optimization) Mark ctor now doesn't check file column for overflow.

This commit is contained in:
Ferdinand Majerech 2014-08-05 13:10:52 +02:00
parent 57afd47bb5
commit 7539b40d3d

View file

@ -31,7 +31,7 @@ package:
// Position in a YAML stream, used for error messages. // Position in a YAML stream, used for error messages.
struct Mark struct Mark
{ {
private: package:
/// Line number. /// Line number.
ushort line_; ushort line_;
/// Column number. /// Column number.
@ -42,7 +42,9 @@ struct Mark
this(const uint line, const uint column) @safe pure nothrow @nogc this(const uint line, const uint column) @safe pure nothrow @nogc
{ {
line_ = cast(ushort)min(ushort.max, line); line_ = cast(ushort)min(ushort.max, line);
column_ = cast(ushort)min(ushort.max, column); // This *will* overflow on extremely wide files but saves CPU time
// (mark ctor takes ~5% of time)
column_ = cast(ushort)column;
} }
/// Get a string representation of the mark. /// Get a string representation of the mark.