</dl><!-- mime -->
+<dl id="math"><dt><a href="/pkg/math/">math</a></dt>
+ <dd>
+ <p><!-- CL 127458 -->
+ The new <a href="/pkg/math/#Fma"><code>Fma</code></a> function
+ computes <code>x*y+z</code> in floating point with no
+ intermediate rounding of the <code>x*y</code>
+ computation. Several architectures implement this computation
+ using dedicated hardware instructions for additional
+ performance.
+ </p>
+
+</dl><!-- math -->
+
<dl id="plugin"><dt><a href="/pkg/plugin/">plugin</a></dt>
<dd>
<p><!-- CL 191617 -->
// New returns a new Hash object. Different hash objects allocated by
// this function will very likely have different seeds.
func New() *Hash {
- seed := Seed{s: uint64(runtime_fastrand())}
+ s1 := uint64(runtime_fastrand())
+ s2 := uint64(runtime_fastrand())
+ seed := Seed{s: s1<<32 + s2}
return &Hash{
seed: seed,
state: seed,
}
}
+func TestHashHighBytes(t *testing.T) {
+ // See issue 34925.
+ const N = 10
+ m := map[uint64]struct{}{}
+ for i := 0; i < N; i++ {
+ h := hash.New()
+ h.AddString("foo")
+ m[h.Hash()>>32] = struct{}{}
+ }
+ if len(m) < N/2 {
+ t.Errorf("from %d seeds, wanted at least %d different hashes; got %d", N, N/2, len(m))
+ }
+}
+
// Make sure a Hash implements the hash.Hash and hash.Hash64 interfaces.
var _ basehash.Hash = &hash.Hash{}
var _ basehash.Hash64 = &hash.Hash{}