示例#1
0
        /// <summary>
        /// Set bits to desired boolean value.
        /// </summary>
        /// <param name="pos">Position in bitfield (must be 0-63).</param>
        /// <param name="value">Value of bits to set.</param>
        /// <param name="numBits">Number of bits to set (must be 1-64).</param>
        public void SetBits(int pos, bool value, int numBits = 1)
        {
            CheckArgs(pos, numBits);
            var mask = 0xfffffffffffffffful >> (64 - numBits);

            Value = Bitwise.SetBits(Value, pos, mask, value);
        }
示例#2
0
 /// <summary>
 /// Set single bit to desired boolean value.
 /// </summary>
 /// <param name="pos">Position in bitfield (must be 0-31).</param>
 /// <param name="value">Value of bits to set.</param>
 public void SetBits(int pos, bool value)
 {
     CheckArgs(pos, 1);
     Value = Bitwise.SetBits(Value, pos, 1, value);
 }