(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.
struct Mark
{
private:
package:
/// Line number.
ushort line_;
/// Column number.
@ -42,7 +42,9 @@ struct Mark
this(const uint line, const uint column) @safe pure nothrow @nogc
{
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.