]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: remove rnd calls that pass a second argument of 1
authorIan Lance Taylor <iant@golang.org>
Mon, 25 Jul 2011 05:03:17 +0000 (22:03 -0700)
committerIan Lance Taylor <iant@golang.org>
Mon, 25 Jul 2011 05:03:17 +0000 (22:03 -0700)
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

src/pkg/runtime/chan.c
src/pkg/runtime/hashmap.c
src/pkg/runtime/iface.c

index ee351a6436e57fe05b2315c31c928b42731cd8ce..b77e51b60da015bbe74a1c56d978b6b65c8755c7 100644 (file)
@@ -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);
index 5ba1eb20ab96b5a49d7e3f2ea0642465f8a3919a..179a56375b1219f9b145d22c0587122bb67f4c5a 100644 (file)
@@ -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",
index 75417cc25cf35fb7bfa8757b9ad77ebe7c6ba5c3..000f834cf3c631a6c3ad11753f37da44e6fa42f9 100644 (file)
@@ -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;