Set last `n` bits in unsigned int

后端 未结 9 1316
小蘑菇
小蘑菇 2020-12-17 15:30

How to set (in most elegant way) exactly n least significant bits of uint32_t? That is to write a function void setbits(uint32_t *x, int n);<

9条回答
提交回复
热议问题