本文整理汇总了C#中Microsoft.Scripting.Math.BigInteger.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# BigInteger.GetHashCode方法的具体用法?C# BigInteger.GetHashCode怎么用?C# BigInteger.GetHashCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Scripting.Math.BigInteger
的用法示例。
在下文中一共展示了BigInteger.GetHashCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: __hash__
public static int __hash__(BigInteger self) {
#if CLR4 // TODO: we might need our own hash code implementation. This avoids assertion failure.
if (self == -2147483648) {
return -2147483648;
}
#endif
// Call the DLR's BigInteger hash function, which will return an int32 representation of
// b if b is within the int32 range. We use that as an optimization for hashing, and
// assert the assumption below.
int hash = self.GetHashCode();
#if DEBUG
int i;
if (self.AsInt32(out i)) {
Debug.Assert(i == hash, String.Format("hash({0}) == {1}", i, hash));
}
#endif
return hash;
}
示例2: Hash
public static int Hash(BigInteger/*!*/ self) {
return self.GetHashCode();
}
示例3: __hash__
public static int __hash__(BigInteger self) {
// Call the DLR's BigInteger hash function, which will return an int32 representation of
// b if b is within the int32 range. We use that as an optimization for hashing, and
// assert the assumption below.
int hash = self.GetHashCode();
#if DEBUG
int i;
if (self.AsInt32(out i)) {
Debug.Assert(i == hash, "input:" + i);
}
#endif
return hash;
}