Commit 9f49a241 authored by Mark Nordine's avatar Mark Nordine

Fix hashcode

parent 2cab6bc6
Pipeline #34589798 passed with stages
in 2 minutes and 13 seconds
......@@ -95,7 +95,25 @@ class ByteArray
}
@override
int get hashCode => _byteData.hashCode;
int get hashCode
{
final tempOffset = offset;
const p = 16777619;
var hash = 2166136261;
for (var i = 0; i < length; i++)
hash = (hash ^ this[i]) * p;
offset = tempOffset;
hash += hash << 13;
hash ^= hash >> 7;
hash += hash << 3;
hash ^= hash >> 17;
hash += hash << 5;
return hash;
}
/// Copies bytes from [bytes] to [this]
void writeBytes(ByteArray bytes, [int offset = 0, int byteCount = 0])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment