C#C
C#4y ago
Raki

❔ How bit wise shift operation work

I started learning bit wise operation.
So i have a uint = 0101 bit which is int 5. Which is in loop to see how it works

Consider n =0101
1st iteration
var test = (n >> 0) // The value is 101

2nd iteration
var test = (n >> 1) // The value of test is 50

How this Happens what i assumed is 0101 on 2nd iteration will become as 1010 so it will be 9. But how it becomes 50.
Was this page helpful?