Skip to content

Instantly share code, notes, and snippets.

@devhawk
Created December 3, 2020 05:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devhawk/fb320df4f777e2f06183a8e97d3e20a2 to your computer and use it in GitHub Desktop.
Save devhawk/fb320df4f777e2f06183a8e97d3e20a2 to your computer and use it in GitHub Desktop.
internal unsafe static void AppendUnmanged<T>(this IncrementalHash hasher, in T item) where T : unmanaged
{
fixed (T* ptr = &item)
{
hasher.AppendData(MemoryMarshal.AsBytes(new ReadOnlySpan<T>(ptr, 1)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment