Skip to content

Commit 30272c6

Browse files
committed
removed [MethodImpl(MethodImplOptions.AggressiveInlining)] attributes
1 parent 66e5929 commit 30272c6

File tree

5 files changed

+15
-20
lines changed

5 files changed

+15
-20
lines changed

src/PolylineAlgorithm/Abstraction/AbstractPolylineEncoder.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,14 @@ public TPolyline Encode(IEnumerable<TCoordinate> coordinates) {
119119

120120
return CreatePolyline(buffer[..position].ToString().AsMemory());
121121

122-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
123122
static int GetCount(IEnumerable<TCoordinate> coordinates) => coordinates switch {
124123
ICollection collection => collection.Count,
125124
_ => coordinates.Count(),
126125
};
127126

128-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
129127
static int GetRequiredLength(CoordinateVariance variance) =>
130128
PolylineEncoding.GetCharCount(variance.Latitude) + PolylineEncoding.GetCharCount(variance.Longitude);
131129

132-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
133130
static int GetRemainingBufferSize(int position, int length) {
134131
Debug.Assert(length > 0, "Buffer length must be greater than zero.");
135132
Debug.Assert(position >= 0, "Position must be non-negative.");
@@ -139,8 +136,7 @@ static int GetRemainingBufferSize(int position, int length) {
139136
return length - position;
140137
}
141138

142-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
143-
int GetBufferLength(int count) {
139+
int GetMaxBufferLength(int count) {
144140
Debug.Assert(count > 0, "Count must be greater than zero.");
145141

146142
int requestedBufferLength = count * Defaults.Polyline.Block.Length.Max;
@@ -180,7 +176,6 @@ static void ValidateEmptyCoordinates(ILogger<AbstractPolylineDecoder<TPolyline,
180176
}
181177
}
182178

183-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
184179
static void ValidateBuffer(ILogger<AbstractPolylineDecoder<TPolyline, TCoordinate>> logger, CoordinateVariance variance, int position, Span<char> buffer) {
185180
if (GetRemainingBufferSize(position, buffer.Length) < GetRequiredLength(variance)) {
186181
logger
@@ -201,7 +196,7 @@ static void ValidateBuffer(ILogger<AbstractPolylineDecoder<TPolyline, TCoordinat
201196
/// <returns>
202197
/// An instance of <typeparamref name="TPolyline"/> representing the encoded polyline.
203198
/// </returns>
204-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
199+
205200
protected abstract TPolyline CreatePolyline(ReadOnlyMemory<char> polyline);
206201

207202
/// <summary>
@@ -211,7 +206,7 @@ static void ValidateBuffer(ILogger<AbstractPolylineDecoder<TPolyline, TCoordinat
211206
/// <returns>
212207
/// The longitude value as a <see cref="double"/>.
213208
/// </returns>
214-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
209+
215210
protected abstract double GetLongitude(TCoordinate? current);
216211

217212
/// <summary>
@@ -221,7 +216,7 @@ static void ValidateBuffer(ILogger<AbstractPolylineDecoder<TPolyline, TCoordinat
221216
/// <returns>
222217
/// The latitude value as a <see cref="double"/>.
223218
/// </returns>
224-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
219+
225220
protected abstract double GetLatitude(TCoordinate? current);
226221
}
227222

src/PolylineAlgorithm/Internal/CoordinateVariance.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public CoordinateVariance() {
4141
/// </summary>
4242
/// <param name="latitude">The next latitude value.</param>
4343
/// <param name="longitude">The next longitude value.</param>
44-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
44+
4545
public void Next(int latitude, int longitude) {
4646
Latitude = Variance(_current.Latitude, latitude);
4747
Longitude = Variance(_current.Longitude, longitude);
@@ -58,7 +58,7 @@ public void Next(int latitude, int longitude) {
5858
/// <param name="initial">The previous coordinate value.</param>
5959
/// <param name="next">The next coordinate value.</param>
6060
/// <returns>The computed variance between <paramref name="initial"/> and <paramref name="next"/>.</returns>
61-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
61+
6262
private static int Variance(int initial, int next) => (initial, next) switch {
6363
(0, 0) => 0,
6464
(0, _) => next,

src/PolylineAlgorithm/PolylineDecoder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public PolylineDecoder(PolylineEncodingOptions options)
1919
: base(options) { }
2020

2121
/// <inheritdoc />
22-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
22+
2323
protected override Coordinate CreateCoordinate(double latitude, double longitude) {
2424
return new(latitude, longitude);
2525
}

src/PolylineAlgorithm/PolylineEncoder.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ public PolylineEncoder(PolylineEncodingOptions options)
1919
: base(options) { }
2020

2121
/// <inheritdoc />
22-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
22+
2323
protected override double GetLatitude(Coordinate coordinate) {
2424
return coordinate.Latitude;
2525
}
2626

2727
/// <inheritdoc />
28-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
28+
2929
protected override double GetLongitude(Coordinate coordinate) {
3030
return coordinate.Longitude;
3131
}
3232

3333
/// <inheritdoc />
34-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
34+
3535
protected override Polyline CreatePolyline(ReadOnlyMemory<char> polyline) {
3636
return Polyline.FromMemory(polyline);
3737
}

src/PolylineAlgorithm/PolylineEncoding.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static class PolylineEncoding {
3737
/// <see langword="true"/> if a value was successfully read and the end of the buffer was not reached; otherwise, <see
3838
/// langword="false"/>.
3939
/// </returns>
40-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
40+
4141
public static bool TryReadValue(ref int variance, ref ReadOnlyMemory<char> buffer, ref int position) {
4242
// Validate that the position is within the bounds of the buffer.
4343
if (position == buffer.Length) {
@@ -88,7 +88,7 @@ public static bool TryReadValue(ref int variance, ref ReadOnlyMemory<char> buffe
8888
/// <exception cref="ArgumentOutOfRangeException">
8989
/// Thrown when <paramref name="value"/> is outside the valid range for the specified <paramref name="type"/>.
9090
/// </exception>
91-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
91+
9292
public static double Denormalize(int value, CoordinateValueType type) {
9393
// Validate that the type is not None, as it does not represent a valid coordinate value type.
9494
if (type == CoordinateValueType.None) {
@@ -130,7 +130,7 @@ public static double Denormalize(int value, CoordinateValueType type) {
130130
/// <returns>
131131
/// <see langword="true"/> if the value was successfully written to the buffer; otherwise, <see langword="false"/>.
132132
/// </returns>
133-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
133+
134134
public static bool TryWriteValue(int variance, ref Span<char> buffer, ref int position) {
135135
// Validate that the position and required space for write is within the bounds of the buffer.
136136
if (buffer.Length < position + GetCharCount(variance)) {
@@ -177,7 +177,7 @@ public static bool TryWriteValue(int variance, ref Span<char> buffer, ref int po
177177
/// Thrown when <paramref name="value"/> is not a finite number or is outside the valid range for the specified
178178
/// <paramref name="type"/>.
179179
/// </exception>
180-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
180+
181181
public static int Normalize(double value, CoordinateValueType type) {
182182
// Validate that the type is not None, as it does not represent a valid coordinate value type.
183183
if (type == CoordinateValueType.None) {
@@ -219,7 +219,7 @@ public static int Normalize(double value, CoordinateValueType type) {
219219
/// The number of characters required to represent the <paramref name="variance"/> value, based on its magnitude.
220220
/// Returns a value between 1 and 6 inclusive.
221221
/// </returns>
222-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
222+
223223
public static int GetCharCount(int variance) => variance switch {
224224
// DO NOT CHANGE THE ORDER. We are skipping inside exclusive ranges as those are covered by previous statements.
225225
>= -16 and <= +15 => 1,

0 commit comments

Comments
 (0)