Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Go compiler directive 'noescape' to assembly implementations #1

Merged
merged 1 commit into from
Feb 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions murmur128_decl.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,30 @@

package murmur3

//go:noescape

// Sum128 returns the murmur3 sum of data. It is equivalent to the following
// sequence (without the extra burden and the extra allocation):
// hasher := New128()
// hasher.Write(data)
// return hasher.Sum128()
func Sum128(data []byte) (h1 uint64, h2 uint64)

//go:noescape

// SeedSum128 returns the murmur3 sum of data with digests initialized to seed1
// and seed2.
//
// The canonical implementation allows only one uint32 seed; to imitate that
// behavior, use the same, uint32-max seed for seed1 and seed2.
func SeedSum128(seed1, seed2 uint64, data []byte) (h1 uint64, h2 uint64)

//go:noescape

// StringSum128 is the string version of Sum128.
func StringSum128(data string) (h1 uint64, h2 uint64)

//go:noescape

// SeedStringSum128 is the string version of SeedSum128.
func SeedStringSum128(seed1, seed2 uint64, data string) (h1 uint64, h2 uint64)
8 changes: 8 additions & 0 deletions murmur32_decl.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,27 @@

package murmur3

//go:noescape

// Sum32 returns the murmur3 sum of data. It is equivalent to the following
// sequence (without the extra burden and the extra allocation):
// hasher := New32()
// hasher.Write(data)
// return hasher.Sum32()
func Sum32(data []byte) (h1 uint32)

//go:noescape

// SeedSum32 returns the murmur3 sum of data with the digest initialized to
// seed.
func SeedSum32(seed uint32, data []byte) (h1 uint32)

//go:noescape

// StringSum32 is the string version of Sum32.
func StringSum32(data string) (h1 uint32)

//go:noescape

// SeedStringSum32 is the string version of SeedSum32.
func SeedStringSum32(seed uint32, data string) (h1 uint32)