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

后端 未结 30 3809
故里飘歌
故里飘歌 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:01

    Find the nearest power of two greater or equal to given number:

    1 << (int)(ceil(log2(given)))
    

    Needed for texturing on hardware that does not support arbitrary texture sizes.

提交回复
热议问题