Quantcast
Channel: sshnet Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1026

Commented Unassigned: SshData.ReadInt64 is broken [2579]

$
0
0
The ReadInt64 method of SshData is not correct. It casts to int before return, and the shifts are missing a cast to long type of thing (as the default shift works on expects int values, and 56 bits don't fit in that case.)
Comments: ** Comment from web user: rjvdboon **

My bit-shifting capabilities are limited (I can read it, but writing it correctly is beyond me;-)

What I would do instead is:
var bytes = ReadBytes(8);
if (BitConverter.IsLittleEndian)
Array.Reverse(bytes);
return BitConverter.ToInt64(bytes,0);

Is that performant enough for you?


Viewing all articles
Browse latest Browse all 1026

Trending Articles