Skip to content

Commit b2f7c38

Browse files
committed
Simplified MimeParser/MimeReader.GetOffset()
This doesn't need to check position < 0, that can never happen.
1 parent ea638f6 commit b2f7c38

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

MimeKit/MimeParser.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
using System.Diagnostics;
3232
using System.Collections;
3333
using System.Collections.Generic;
34+
using System.Runtime.CompilerServices;
3435

3536
using MimeKit.IO;
3637
using MimeKit.Utils;
@@ -665,11 +666,9 @@ int ReadAhead (int atleast, int save, CancellationToken cancellationToken)
665666
return inputEnd - inputIndex;
666667
}
667668

669+
[MethodImpl (MethodImplOptions.AggressiveInlining)]
668670
long GetOffset (int index)
669671
{
670-
if (position == -1)
671-
return -1;
672-
673672
return position - (inputEnd - index);
674673
}
675674

MimeKit/MimeReader.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1120,11 +1120,9 @@ int ReadAhead (int atleast, int save, CancellationToken cancellationToken)
11201120
return inputEnd - inputIndex;
11211121
}
11221122

1123+
[MethodImpl (MethodImplOptions.AggressiveInlining)]
11231124
long GetOffset (int index)
11241125
{
1125-
if (position == -1)
1126-
return -1;
1127-
11281126
return position - (inputEnd - index);
11291127
}
11301128

0 commit comments

Comments
 (0)