summaryrefslogtreecommitdiff
path: root/Binaries
diff options
context:
space:
mode:
authorGravatar qunyanm <unknown>2015-04-14 10:09:03 -0700
committerGravatar qunyanm <unknown>2015-04-14 10:09:03 -0700
commit38134c5587ea53e71290e2e8ea9915062172865b (patch)
tree26116aeedd7ba60a3a3bc91d798d7ea333637d79 /Binaries
parent90c68ad369e3f9318d4f31ed4f9e628cb7f2738d (diff)
Fix issue #68. Change GetHashCode implementation for Sequence.
Diffstat (limited to 'Binaries')
-rw-r--r--Binaries/DafnyRuntime.cs8
1 files changed, 7 insertions, 1 deletions
diff --git a/Binaries/DafnyRuntime.cs b/Binaries/DafnyRuntime.cs
index ef6da67e..a682422a 100644
--- a/Binaries/DafnyRuntime.cs
+++ b/Binaries/DafnyRuntime.cs
@@ -499,7 +499,13 @@ namespace Dafny
return other is Sequence<T> && Equals((Sequence<T>)other);
}
public override int GetHashCode() {
- return elmts.GetHashCode();
+ if (elmts == null || elmts.Length == 0)
+ return 0;
+ var hashCode = 0;
+ for (var i = 0; i < elmts.Length; i++) {
+ hashCode = (hashCode << 3) | (hashCode >> 29) ^ elmts[i].GetHashCode();
+ }
+ return hashCode;
}
public override string ToString() {
if (elmts is char[]) {