Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Thrift-1709:Warning "Bitwise-or operator used on a sign-extended oper…

…and;..."

Client: csharp
Patch: Jake Farrell

Reverts initial patch submitted with ticket and changes to using unchecked {} due to reported memory issues with the previous patch.



git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1400487 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 98f93778e1ea5b8b3dbed7bb946cddf6208fbe42 1 parent 771ca3c
@jfarrell jfarrell authored
Showing with 11 additions and 9 deletions.
  1. +11 −9 lib/csharp/src/Protocol/TBinaryProtocol.cs
View
20 lib/csharp/src/Protocol/TBinaryProtocol.cs
@@ -347,15 +347,17 @@ public override int ReadI32()
public override long ReadI64()
{
ReadAll(i64in, 0, 8);
- return (long)(
- (ulong)((ulong)(i64in[0] & 0xff) << 56) |
- (ulong)((ulong)(i64in[1] & 0xff) << 48) |
- (ulong)((ulong)(i64in[2] & 0xff) << 40) |
- (ulong)((ulong)(i64in[3] & 0xff) << 32) |
- (ulong)((ulong)(i64in[4] & 0xff) << 24) |
- (ulong)((ulong)(i64in[5] & 0xff) << 16) |
- (ulong)((ulong)(i64in[6] & 0xff) << 8) |
- (ulong)((ulong)(i64in[7] & 0xff)));
+ unchecked {
+ return (long)(
+ ((long)(i64in[0] & 0xff) << 56) |
+ ((long)(i64in[1] & 0xff) << 48) |
+ ((long)(i64in[2] & 0xff) << 40) |
+ ((long)(i64in[3] & 0xff) << 32) |
+ ((long)(i64in[4] & 0xff) << 24) |
+ ((long)(i64in[5] & 0xff) << 16) |
+ ((long)(i64in[6] & 0xff) << 8) |
+ ((long)(i64in[7] & 0xff)));
+ }
}
public override double ReadDouble()
Please sign in to comment.
Something went wrong with that request. Please try again.