binary-operators

What are bitwise shift (bit-shift) operators and how do they work?

萝らか妹 提交于 2019-11-26 01:18:17
问题 I\'ve been attempting to learn C in my spare time, and other languages (C#, Java, etc.) have the same concept (and often the same operators) ... What I\'m wondering is, at a core level, what does bit-shifting ( << , >> , >>> ) do, what problems can it help solve, and what gotchas lurk around the bend? In other words, an absolute beginner\'s guide to bit shifting in all its goodness. 回答1: The bit shifting operators do exactly what their name implies. They shift bits. Here's a brief (or not-so