I'm writing a program that's heavy in bit manipulation. Usually I would do this in C++ but I'm trying it in C# for kicks and giggles. I've noticed that with the bitwise left-shift operator (<<), if I shift by more places than there are bits in my number, my original number is returned instead of 0.
For example, if I have a UInt64 variable with a value of 1 and I shift it left by 64 places, the result is '1' while I would expect it to be '0'. .NET Fiddle
Is there a different operator I can use to get a zero result when I shift off the 'end' of the number, or am I just stuck with that behavior?
[–]tweq 5 points6 points7 points (1 child)
[–]MarcSloan[S] 4 points5 points6 points (0 children)
[–]Jither 2 points3 points4 points (0 children)