예제 #1
0
        public override int GetHashCode()
        {
            int h1 = Numerator.GetHashCode();
            int h2 = Denominator.GetHashCode();

            return(((h1 << 5) + h1) ^ h2);
        }
예제 #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((Numerator.GetHashCode() * 397) ^ Denominator.GetHashCode());
     }
 }
예제 #3
0
파일: mpq.cs 프로젝트: Samayel/Mpir.NET
        public override int GetHashCode()
        {
            var num = Numerator.GetHashCode();
            var den = Denominator.GetHashCode();

            return(((num << 5) + num) ^ den);
        }
예제 #4
0
 /// <summary>
 /// Serves as the default hash function.
 /// </summary>
 /// <returns>A hash code for the current object.</returns>
 public override int GetHashCode()
 {
     return(base.GetHashCode() ^ Numerator.GetHashCode() ^
            Denominator.GetHashCode() ^
            ClocksPerClick.GetHashCode() ^
            NumberOf32ndNotesPerBeat.GetHashCode());
 }
예제 #5
0
        public override int GetHashCode()
        {
            int nhash = Numerator.GetHashCode();
            int dhash = Denominator.GetHashCode();

            return((nhash + dhash) / dhash);
        }
예제 #6
0
        /// <inheritdoc />
        public override int GetHashCode()
        {
#if NO_HASHCODE
            return(HashHelpers.Combine(Numerator.GetHashCode(), Denominator.GetHashCode()));
#else
            return(HashCode.Combine(Numerator, Denominator));
#endif
        }
예제 #7
0
        public override int GetHashCode()
        {
            var hashCode = -1534900553;

            hashCode = hashCode * -1521134295 + Numerator.GetHashCode();
            hashCode = hashCode * -1521134295 + Denumerator.GetHashCode();
            return(hashCode);
        }
예제 #8
0
        public override int GetHashCode()
        {
            var hash = 17;

            hash = hash * 23 + Numerator.GetHashCode();
            hash = hash * 23 + Denominator.GetHashCode();
            return(hash);
        }
예제 #9
0
        public override int GetHashCode()
        {
            int hashCode = -3233;

            hashCode = hashCode * -1221 + Numerator.GetHashCode();
            hashCode = hashCode * -121 + Denominator.GetHashCode();
            return(hashCode);
        }
예제 #10
0
        public override int GetHashCode()
        {
            ReduceImplementation(ref this);

            int numeratorHash   = Numerator.GetHashCode();
            int denominatorHash = Denominator.GetHashCode();

            return(numeratorHash ^ denominatorHash);
        }
예제 #11
0
        public override int GetHashCode()
        {
            int hash = 13;

            hash = (hash * 7) + Denominator.GetHashCode();
            hash = (hash * 7) + Numerator.GetHashCode();

            return(hash);
        }
예제 #12
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 17;
         hash = hash * 23 + Numerator.GetHashCode();
         hash = hash * 23 + Denominator.GetHashCode();
         return(hash);
     }
 }
예제 #13
0
 /// <summary>
 /// Returns the hash code for this instance.
 /// </summary>
 /// <returns>A 32-bit signed integer hash code.</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var result = 17;
         result = result * 23 + Numerator.GetHashCode();
         result = result * 23 + Denominator.GetHashCode();
         return(result);
     }
 }
예제 #14
0
 public override int GetHashCode()
 {
     unchecked {
         return
             (base.GetHashCode()
              + 17 * Numerator?.GetHashCode() ?? 0
              + 19 * Denominator?.GetHashCode() ?? 0
              + 61 * LeftDelimiter?.GetHashCode() ?? 0
              + 101 * RightDelimiter?.GetHashCode() ?? 0);
     }
 }
예제 #15
0
            public override int GetHashCode()
            {
                var hashCode = 893539880;

                hashCode = hashCode * -1521134295 + Numerator.GetHashCode();
                hashCode = hashCode * -1521134295 + Denominator.GetHashCode();
                hashCode = hashCode * -1521134295 + IntPart.GetHashCode();
                hashCode = hashCode * -1521134295 + EqualityComparer <Rational> .Default.GetHashCode(FracPart);

                return(hashCode);
            }
예제 #16
0
파일: Fraction.cs 프로젝트: bcr/FractionFun
        // https://stackoverflow.com/questions/263400/what-is-the-best-algorithm-for-an-overridden-system-object-gethashcode

        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hash = 17;
                // Suitable nullity checks etc, of course :)
                hash = hash * 23 + Numerator.GetHashCode();
                hash = hash * 23 + Denominator.GetHashCode();
                return(hash);
            }
        }
        public override int GetHashCode()
        {
            var hashCode = 3571;             //TODO May need better primes

            unchecked {
                hashCode = hashCode * -7919 + Numerator.GetHashCode();
                hashCode = hashCode * -7919 + Denominator.GetHashCode();
                hashCode = hashCode * -7919 + RatioSeparator.GetHashCode();
            }
            return(hashCode);
        }
예제 #18
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Numerator != 0L)
            {
                hash ^= Numerator.GetHashCode();
            }
            if (Denominator != 0L)
            {
                hash ^= Denominator.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (Numerator != 0)
            {
                hash ^= Numerator.GetHashCode();
            }
            if (Denominator != global::Envoy.Type.FractionalPercent.Types.DenominatorType.Hundred)
            {
                hash ^= Denominator.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
예제 #20
0
 public override int GetHashCode() => ((-1 + Numerator.GetHashCode()) * (5 + Denominator.GetHashCode()));
예제 #21
0
 public override int GetHashCode()
 {
     return(13 * (Numerator.GetHashCode() + Denominator.GetHashCode()));
 }
예제 #22
0
 public override int GetHashCode() => Numerator.GetHashCode() ^ Denominator.GetHashCode();
예제 #23
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     return unchecked(Numerator.GetHashCode() * 17 + Denominator.GetHashCode());
 }
예제 #24
0
 public override int GetHashCode()
 {
     return($"RoyaltyDefinition:{RoyaltyType.GetHashCode()}:{Account?.GetHashCode()}:{Token?.GetHashCode()}:{FixedAmount?.GetHashCode()}:{Numerator?.GetHashCode()}:{Denominator?.GetHashCode()}:{FallbackAmount?.GetHashCode()}:{FallbackToken?.GetHashCode()}:{Minimum?.GetHashCode()}:{Maximum?.GetHashCode()}:{AssessAsSurcharge.GetHashCode()}".GetHashCode());
 }
예제 #25
0
 public override int GetHashCode()
 {
     return(WholeNumber.GetHashCode() ^ Numerator.GetHashCode() ^ Denominator.GetHashCode());
 }
예제 #26
0
 public override int GetHashCode()
 {
     return(unchecked (Denominator.GetHashCode() * 397) ^ Numerator.GetHashCode());
 }