THRIFT-1973 TCompactProtocol in C# lib does not serialize and deserialize negative int32 and int64 number correctly
Patch: Eric Ding
diff --git a/lib/csharp/src/Protocol/TCompactProtocol.cs b/lib/csharp/src/Protocol/TCompactProtocol.cs
index 6e8cafd..a498577 100644
--- a/lib/csharp/src/Protocol/TCompactProtocol.cs
+++ b/lib/csharp/src/Protocol/TCompactProtocol.cs
@@ -442,7 +442,7 @@
*/
private ulong longToZigzag(long n)
{
- return (ulong)(((ulong)n << 1) ^ ((ulong)n >> 63));
+ return (ulong)(n << 1) ^ (ulong)(n >> 63);
}
/**
@@ -451,7 +451,7 @@
*/
private uint intToZigZag(int n)
{
- return (uint)(((uint)n << 1) ^ ((uint)n >> 31));
+ return (uint)(n << 1) ^ (uint)(n >> 31);
}
/**