Have you ever had to use bit shifting in real projects?

后端 未结 30 3812
故里飘歌
故里飘歌 2020-12-02 05:35

Have you ever had to use bit shifting in real programming projects? Most (if not all) high level languages have shift operators in them, but when would you actually need to

30条回答
  •  栀梦
    栀梦 (楼主)
    2020-12-02 06:08

    I have seen bitwise operators used when multiple flags were used as a property parameter. For example number 4 = 1 0 0 means that one of the three flags is set. This is not good for public API but it can speed up things in special cases since checking for bits is fast.

提交回复
热议问题