掩码

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP






掩码英语:Mask)在计算机学科及数字逻辑中指的是一串二进制数字,通过与目标数字的按位操作,达到屏蔽指定位而实现需求。



示例


创造一个掩码msk把一个指令cmd的第0~3位(右边第一位为0位)清零:


指令cmd = 0110011011


创造掩码msk = 0000001111


用掩码的反码~msk和指令cmd做按位与运算cmd & ~msk = 0110011011 & 1111110000 = 0110010000


则指定的第0~3位已被清零。



參見


  • 位段

  • 子网


外部链接


  • bit_enum: a type-safe C++ library for bitwise operations

Popular posts from this blog

California gubernatorial recall election

Telugu cinema

List of Pawn Stars episodes