mirror of
https://github.com/golang/go
synced 2024-11-25 06:07:58 -07:00
runtime: remove rnd calls that pass a second argument of 1
When rnd is called with a second argument of 1, it simply returns the first argument anyway. R=golang-dev, r CC=golang-dev https://golang.org/cl/4820045
This commit is contained in:
parent
a1e7cd97d5
commit
3a07d516b4
@ -427,7 +427,7 @@ runtime·chanrecv2(Hchan* c, ...)
|
||||
|
||||
o = runtime·rnd(sizeof(c), Structrnd);
|
||||
ae = (byte*)&c + o;
|
||||
o = runtime·rnd(o+c->elemsize, 1);
|
||||
o += c->elemsize;
|
||||
ac = (byte*)&c + o;
|
||||
|
||||
runtime·chanrecv(c, ae, nil, ac);
|
||||
|
@ -753,12 +753,12 @@ runtime·makemap_c(Type *key, Type *val, int64 hint)
|
||||
// func(key) (val[, pres])
|
||||
h->ko1 = runtime·rnd(sizeof(h), key->align);
|
||||
h->vo1 = runtime·rnd(h->ko1+keysize, Structrnd);
|
||||
h->po1 = runtime·rnd(h->vo1+valsize, 1);
|
||||
h->po1 = h->vo1 + valsize;
|
||||
|
||||
// func(key, val[, pres])
|
||||
h->ko2 = runtime·rnd(sizeof(h), key->align);
|
||||
h->vo2 = runtime·rnd(h->ko2+keysize, val->align);
|
||||
h->po2 = runtime·rnd(h->vo2+valsize, 1);
|
||||
h->po2 = h->vo2 + valsize;
|
||||
|
||||
if(debug) {
|
||||
runtime·printf("makemap: map=%p; keysize=%d; valsize=%d; keyalg=%d; valalg=%d; offsets=%d,%d; %d,%d,%d; %d,%d,%d\n",
|
||||
|
@ -265,7 +265,7 @@ runtime·assertI2T2(Type *t, Iface i, ...)
|
||||
|
||||
ret = (byte*)(&i+1);
|
||||
wid = t->size;
|
||||
ok = (bool*)(ret+runtime·rnd(wid, 1));
|
||||
ok = (bool*)(ret + wid);
|
||||
|
||||
if(i.tab == nil || i.tab->type != t) {
|
||||
*ok = false;
|
||||
@ -327,7 +327,7 @@ runtime·assertE2T2(Type *t, Eface e, ...)
|
||||
runtime·throw("invalid interface value");
|
||||
ret = (byte*)(&e+1);
|
||||
wid = t->size;
|
||||
ok = (bool*)(ret+runtime·rnd(wid, 1));
|
||||
ok = (bool*)(ret + wid);
|
||||
|
||||
if(t != e.type) {
|
||||
*ok = false;
|
||||
|
Loading…
Reference in New Issue
Block a user