Exemplo n.º 1
0
 public int CompareTo(EntityData other)
 {
     // if (FlagsDense == other.FlagsDense) return 0;
     // var diff = BitUtils.BitCount(FlagsDense ^ other.FlagsDense);
     // var equal = BitUtils.BitCount(FlagsDense & other.FlagsDense);
     // if (diff > equal) return 1;
     // return -1;
     return(FlagsSparse.CompareTo(other.FlagsSparse));//TODO figure something clever!
 }
        static StackObject *CompareTo_3(ILIntepreter __intp, StackObject *__esp, List <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.UInt64 value = *(ulong *)&ptr_of_this_method->Value;
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.UInt64 instance_of_this_method = GetInstance(__domain, ptr_of_this_method, __mStack);

            var result_of_this_method = instance_of_this_method.CompareTo(value);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method;
            return(__ret + 1);
        }
        static StackObject *CompareTo_0(ILIntepreter __intp, StackObject *__esp, List <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Object value = (System.Object) typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.UInt64 instance_of_this_method = GetInstance(__domain, ptr_of_this_method, __mStack);

            var result_of_this_method = instance_of_this_method.CompareTo(value);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method;
            return(__ret + 1);
        }
 /// <summary>
 ///     A T extension method that check if the value is between (exclusif) the minValue and maxValue.
 /// </summary>
 /// <param name="this">The @this to act on.</param>
 /// <param name="minValue">The minimum value.</param>
 /// <param name="maxValue">The maximum value.</param>
 /// <returns>true if the value is between the minValue and maxValue, otherwise false.</returns>
 /// ###
 /// <typeparam name="T">Generic type parameter.</typeparam>
 public static bool Between(this UInt64 @this, UInt64 minValue, UInt64 maxValue)
 {
     return minValue.CompareTo(@this) == -1 && @this.CompareTo(maxValue) == -1;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Compares the internal value of the current <see cref="Size" /> struct to
 /// another value.
 /// </summary>
 /// <param name="other">An object to compare with this object.</param>
 /// <returns>
 /// A value that indicates the relative order of the objects being compared.
 /// The return value has the following meanings:
 /// <list type="table">
 /// <listheader>
 /// <term>Value</term>
 /// <term>Meaning</term>
 /// </listheader>
 /// <item>
 /// <term>Less than zero</term>
 /// <term>The value is less than the <paramref name="other" /> parameter.</term>
 /// </item>
 /// <item>
 /// <term>Zero</term>
 /// <term>The value is equal to <paramref name="other" />.</term>
 /// </item>
 /// <item>
 /// <term>Greater than zero</term>
 /// <term>The value is greater than <paramref name="other" />.</term>
 /// </item>
 /// </list>
 /// </returns>
 public int CompareTo(size_t other)
 {
     return(_value.CompareTo(other));
 }