示例#1
0
        public static BlockHandle ConvertToBlockHandle(this BlockAlias alias, BlockHandleMask mask)
        {
            if (!alias.IsDefined)
            {
                return(BlockHandle.Undefined);
            }

            // Idem, see above.
            return(new BlockHandle(alias.Value ^ (~0x01u & (BlockHandle.DefaultMask ^ mask.Value))));
        }
示例#2
0
        public static BlockAlias ConvertToBlockAlias(this BlockHandle handle, BlockHandleMask mask)
        {
            if (!handle.IsDefined)
            {
                return(BlockAlias.Undefined);
            }

            // The handle is XORed with the base mask and a client specific mask
            // to obtain the alias. The '~0x01u' bits ensure that the 'IsDefined'
            // bit is preserved when converting from handle to alias and vice-versa.
            return(new BlockAlias(handle.Value ^ (~0x01u & (BlockHandle.DefaultMask ^ mask.Value))));
        }