问题:
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) ... 我一直在尝试在业余时间学习C语言,其他语言(C#,Java等)具有相同的概念(通常是相同的运算符)......
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. 换句话说,一个绝对的初学者指导比特移位的所有优点。
解决方案:
参考一: https://stackoom.com/question/aof/什么是按位移位-位移-运算符以及它们如何工作参考二: https://oldbug.net/q/aof/What-are-bitwise-shift-bit-shift-operators-and-how-do-they-work
来源:oschina
链接:https://my.oschina.net/u/4438370/blog/4306620