On Thu, Mar 15, 2018 at 1:34 AM,  <lizhiyua...@gmail.com> wrote:
>
> when evacuate oldbucket, go will migrate the data to a new position.
>
> and i found it used X and Y as two bucket where Xi equal the old index in
> h.oldbuckets and Yi equal Xi plus newbit
>
> suppose the length of oldbuckets is 8 , and the hash of a key is 13 (just a
> example), then it will be put in the 5. Now, the buckets grow to 16,  it
> should be put in the 13. I think.
>
> but i found the code below.
>
> https://github.com/golang/go/blob/6732fcc06df713fc737cee5c5860bad87599bc6d/src/runtime/hashmap.go#L1115
>
>
>
>
>
> useX will be true, if so, the 13 will be put in the 5 still, then i can't
> understand it. Did i miss something ?
>
> go 1.9

When a bucket is split into two new buckets, X and Y, each value has
to go to either X or Y.  The decision is made by looking at the hash.
That is the code you are looking at.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to