1
0
mirror of https://github.com/golang/go synced 2024-11-25 08:17: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:
Ian Lance Taylor 2011-07-24 22:03:17 -07:00
parent a1e7cd97d5
commit 3a07d516b4
3 changed files with 5 additions and 5 deletions

View File

@ -427,7 +427,7 @@ runtime·chanrecv2(Hchan* c, ...)
o = runtime·rnd(sizeof(c), Structrnd); o = runtime·rnd(sizeof(c), Structrnd);
ae = (byte*)&c + o; ae = (byte*)&c + o;
o = runtime·rnd(o+c->elemsize, 1); o += c->elemsize;
ac = (byte*)&c + o; ac = (byte*)&c + o;
runtime·chanrecv(c, ae, nil, ac); runtime·chanrecv(c, ae, nil, ac);

View File

@ -753,12 +753,12 @@ runtime·makemap_c(Type *key, Type *val, int64 hint)
// func(key) (val[, pres]) // func(key) (val[, pres])
h->ko1 = runtime·rnd(sizeof(h), key->align); h->ko1 = runtime·rnd(sizeof(h), key->align);
h->vo1 = runtime·rnd(h->ko1+keysize, Structrnd); 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]) // func(key, val[, pres])
h->ko2 = runtime·rnd(sizeof(h), key->align); h->ko2 = runtime·rnd(sizeof(h), key->align);
h->vo2 = runtime·rnd(h->ko2+keysize, val->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) { 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", runtime·printf("makemap: map=%p; keysize=%d; valsize=%d; keyalg=%d; valalg=%d; offsets=%d,%d; %d,%d,%d; %d,%d,%d\n",

View File

@ -265,7 +265,7 @@ runtime·assertI2T2(Type *t, Iface i, ...)
ret = (byte*)(&i+1); ret = (byte*)(&i+1);
wid = t->size; wid = t->size;
ok = (bool*)(ret+runtime·rnd(wid, 1)); ok = (bool*)(ret + wid);
if(i.tab == nil || i.tab->type != t) { if(i.tab == nil || i.tab->type != t) {
*ok = false; *ok = false;
@ -327,7 +327,7 @@ runtime·assertE2T2(Type *t, Eface e, ...)
runtime·throw("invalid interface value"); runtime·throw("invalid interface value");
ret = (byte*)(&e+1); ret = (byte*)(&e+1);
wid = t->size; wid = t->size;
ok = (bool*)(ret+runtime·rnd(wid, 1)); ok = (bool*)(ret + wid);
if(t != e.type) { if(t != e.type) {
*ok = false; *ok = false;