Performance optimization for integer value serialization. (#1544)

* Performance optimization for integer serialization.

* Add int32 overloads for integer formatter.

* fix parameter name

* Prefer using the faster, 32 bit division code path, when possible.

* fix code formatting

* fix uint range check, add test coverage
This commit is contained in:
Mark Pflug
2017-12-20 11:08:09 +13:00
committed by James Newton-King
parent a8245a5b9e
commit 3ea750d6d6
3 changed files with 86 additions and 7 deletions
@@ -902,6 +902,9 @@ namespace Newtonsoft.Json.Tests
jsonWriter.WriteValue(long.MinValue);
jsonWriter.WriteValue(ulong.MaxValue);
jsonWriter.WriteValue(ulong.MinValue);
jsonWriter.WriteValue((ulong)uint.MaxValue - 1);
jsonWriter.WriteValue((ulong)uint.MaxValue);
jsonWriter.WriteValue((ulong)uint.MaxValue + 1);
jsonWriter.WriteEndArray();
}
@@ -918,7 +921,10 @@ namespace Newtonsoft.Json.Tests
9223372036854775807,
-9223372036854775808,
18446744073709551615,
0
0,
4294967294,
4294967295,
4294967296
]", sb.ToString());
}