tests or sets bit of a u8 type array
static inline int uvc_test_bit(const __u8 *data, int bit)
{return (data[bit >> 3] >> (bit & 7)) & 1;
}
static inline void uvc_clear_bit(__u8 *data, int bit)
{
data[bit >> 3] &= ~(1 << (bit & 7));
}
notice: data is u8 type ptr, so it can tests or sets bit of a u8 type array.
本文介绍了针对u8类型数组的位操作方法,包括如何检测特定位置的比特是否为1以及如何清除指定位置的比特。这些方法使用位移和按位与运算实现高效处理。
1024

被折叠的 条评论
为什么被折叠?



