Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

how bitwise shift operation is happening ?

$
0
0

I have done a small program to understand, how bitwise left shift operation is working ? 

var result = 2088883663 << 5;

Binary value for 2088883663 is 01111100100000011101010111001111

result binary value is 10010000001110101011100111100000 => my expected result should be 2419767776

but it overflows with int MaxValue so I thought result would be less than expected result (2419767776)

but I got

Output:

-1875199520 (negative value) I don't know how it is working can any one guide me ?

NOTE: I know for positive numbers, shifting operation makes 0(zero) to fill backing element.


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>