Skip to content

Instantly share code, notes, and snippets.

@awreece
Created April 14, 2012 21:52
Show Gist options
  • Save awreece/2388037 to your computer and use it in GitHub Desktop.
Save awreece/2388037 to your computer and use it in GitHub Desktop.
Go source is unreadable
$ hg blame runtime.c | grep runtime·rnd
6707: runtime·rnd(uint32 n, uint32 m)
$ hg log -r 6707
changeset: 6707:629c065d3679
user: Russ Cox <rsc@golang.org>
date: Thu Nov 04 14:00:19 2010 -0400
summary: runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
$ grep runtime·rnd *
chan.c: ap = ae + runtime·rnd(t->elem->size, Structrnd);
chan.c: o = runtime·rnd(sizeof(size), Structrnd);
hashmap.c: datasize = runtime·rnd(datasize, sizeof (void *));
hashmap.c: h->valoff = runtime·rnd(key->size, sizeof(void*));
hashmap.c: av = ak + runtime·rnd(t->key->size, Structrnd);
hashmap.c: av = ak + runtime·rnd(t->key->size, Structrnd);
hashmap.c: av = ak + runtime·rnd(t->key->size, t->elem->align);
hashmap.c: av = ak + runtime·rnd(t->key->size, t->elem->align);
iface.c: ret = (Iface*)(elem + runtime·rnd(wid, Structrnd));
iface.c: ret = (Eface*)(elem + runtime·rnd(wid, Structrnd));
print.c: arg = runtime·rnd(arg, 4);
print.c: arg = runtime·rnd(arg, sizeof(uintptr));
print.c: arg = runtime·rnd(arg, sizeof(uintptr));
print.c: arg = runtime·rnd(arg, sizeof(uintptr));
print.c: arg = runtime·rnd(arg, sizeof(uintptr));
print.c: arg = runtime·rnd(arg, sizeof(uintptr));
print.c: arg = runtime·rnd(arg, sizeof(uintptr));
runtime.c:runtime·rnd(uint32 n, uint32 m)
runtime.h:uint32 runtime·rnd(uint32, uint32);
uint32
runtime·rnd(uint32 n, uint32 m)
{
uint32 r;
if(m > maxround)
m = maxround;
r = n % m;
if(r)
n += m-r;
return n;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment