public void TestHash32Span() { var data = new byte[] { 1 }; Span <byte> sp = data; var expected = Farmhash.Hash32(data, data.Length); Assert.Equal(Farmhash.Hash32(sp), expected); }
public unsafe void TestHash32(String str, uint expected) { var bytes = Encoding.ASCII.GetBytes(str); Assert.Equal(Farmhash.Hash32(bytes, bytes.Length), expected); fixed(byte *ptr = bytes) { Assert.Equal(Farmhash.Hash32(ptr, bytes.Length), expected); } var strBytes = Encoding.Unicode.GetBytes(str); Assert.Equal(Farmhash.Hash32(strBytes, strBytes.Length), Farmhash.Hash32(str)); #if NETCOREAPP2_1 Span <byte> sp = bytes; Assert.Equal(Farmhash.Hash32(sp), expected); #endif }
public void TestHash32(String str, uint expected) { var bytes = Encoding.ASCII.GetBytes(str); Assert.Equal(Farmhash.Hash32(bytes, bytes.Length), expected); }
public uint FarmHash() => Farmhash.Hash32(data, data.Length);