コード例 #1
0
 /// <inheritdoc cref="IBinaryNumber{TSelf}.Log2(TSelf)" />
 public static long Log2(long value)
 {
     if (value < 0)
     {
         ThrowHelper.ThrowValueArgumentOutOfRange_NeedNonNegNumException();
     }
     return(BitOperations.Log2((ulong)value));
 }
コード例 #2
0
ファイル: Int32.cs プロジェクト: mateoatr/runtime
 static int IBinaryNumber <int> .Log2(int value)
 {
     if (value < 0)
     {
         ThrowHelper.ThrowValueArgumentOutOfRange_NeedNonNegNumException();
     }
     return(BitOperations.Log2((uint)value));
 }
コード例 #3
0
 /// <inheritdoc cref="IBinaryNumber{TSelf}.Log2(TSelf)" />
 public static sbyte Log2(sbyte value)
 {
     if (value < 0)
     {
         ThrowHelper.ThrowValueArgumentOutOfRange_NeedNonNegNumException();
     }
     return((sbyte)BitOperations.Log2((byte)value));
 }
コード例 #4
0
 /// <inheritdoc cref="IBinaryNumber{TSelf}.Log2(TSelf)" />
 public static short Log2(short value)
 {
     if (value < 0)
     {
         ThrowHelper.ThrowValueArgumentOutOfRange_NeedNonNegNumException();
     }
     return((short)BitOperations.Log2((ushort)value));
 }
コード例 #5
0
        public static Index FromEnd(int value)
        {
            if (value < 0)
            {
                ThrowHelper.ThrowValueArgumentOutOfRange_NeedNonNegNumException();
            }

            return(new Index(~value));
        }
コード例 #6
0
        public Index(int value, bool fromEnd)
        {
            if (value < 0)
            {
                ThrowHelper.ThrowValueArgumentOutOfRange_NeedNonNegNumException();
            }

            _value = fromEnd ? ~value : value;
        }
コード例 #7
0
        public Index(int value, bool fromEnd = false)
        {
            if (value < 0)
            {
                ThrowHelper.ThrowValueArgumentOutOfRange_NeedNonNegNumException();
            }

            if (fromEnd)
            {
                _value = ~value;
            }
            else
            {
                _value = value;
            }
        }