Skip to content

Commit da81dca

Browse files
committed
fixed GetCharCount method and tests
1 parent f44ac22 commit da81dca

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/PolylineAlgorithm/PolylineEncoding.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,9 @@ public static int Normalize(double value, CoordinateValueType type) {
223223
/// <returns>
224224
/// The number of characters required to represent the <paramref name="variance"/> value, based on its magnitude.
225225
/// </returns>
226-
227226
public static int GetCharCount(int variance) {
228-
int rem = variance << 1;
227+
long rem = (long)variance << 1;
228+
229229
if (variance < 0) {
230230
rem = ~rem;
231231
}

tests/PolylineAlgorithm.Tests/PolylineEncodingTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ public class PolylineEncodingTest {
101101
(-16777216,5),
102102
(16777216,6),
103103
(-16777217,6),
104-
(int.MaxValue,6),
105-
(int.MinValue,6),
104+
(int.MaxValue,7),
105+
(int.MinValue,7),
106106
];
107107

108108
#endregion

0 commit comments

Comments
 (0)