Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

this change seems safe as the two should be equivalent.and it doesnt

create an array on each
  • Loading branch information...
commit 3a6207191d648eec1d366416b48277026ba977f1 1 parent 6635977
@gregoryyoung gregoryyoung authored
View
5 src/EventStore/EventStore.Core/Index/Hashes/Murmur2Unsafe.cs
@@ -42,10 +42,9 @@ public class Murmur2Unsafe: IHasher
public unsafe UInt32 Hash(string s)
{
- var data = s.ToCharArray();
- fixed (char* input = &data[0])
+ fixed (char* input = s)
{
- return Hash((byte*)input, (uint)data.Length * sizeof(char), Seed);
+ return Hash((byte*)input, (uint)s.Length * sizeof(char), Seed);
}
}
View
7 src/EventStore/EventStore.Core/Index/Hashes/Murmur3AUnsafe.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2012, Event Store LLP
+// Copyright (c) 2014, Event Store LLP
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -38,10 +38,9 @@ public class Murmur3AUnsafe : IHasher
public unsafe UInt32 Hash(string s)
{
- var data = s.ToCharArray();
- fixed (char* input = &data[0])
+ fixed (char* input = s)
{
- return Hash((byte*)input, (uint)data.Length * sizeof(char), Seed);
+ return Hash((byte*)input, (uint)s.Length * sizeof(char), Seed);
}
}
View
7 src/EventStore/EventStore.Core/Index/Hashes/XXHashUnsafe.cs
@@ -1,4 +1,4 @@
-// Copyright (c) 2012, Event Store LLP
+// Copyright (c) 2014, Event Store LLP
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -41,10 +41,9 @@ public class XXHashUnsafe: IHasher
public unsafe UInt32 Hash(string s)
{
- var data = s.ToCharArray();
- fixed (char* input = &data[0])
+ fixed (char* input =s)
{
- return Hash((byte*) input, (uint) data.Length*sizeof (char), Seed);
+ return Hash((byte*) input, (uint) s.Length*sizeof (char), Seed);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.