bitmask(位掩码/比特掩码):在计算机中用一串二进制位(0/1)作为“掩码”,通过按位运算(如 AND、OR、XOR)来选择、屏蔽或提取某些位,常用于标志位(flags)、权限、状态字段等。
/ˈbɪtˌmæsk/
Use a bitmask to enable debug logging.
用位掩码来启用调试日志。
In this protocol, the header stores multiple options in one integer, and we decode them with a bitmask and bitwise AND.
在这个协议里,头部用一个整数存放多个选项,我们用位掩码配合按位与来解码它们。
由 bit(比特,二进制位)+ mask(面具/遮罩/掩码)构成:意思是“用来遮住或筛选某些比特位的遮罩”。在底层编程与硬件相关语境中非常常见。