~mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
progs/perftest.c: Use from Glibc syscall numbers.
[catacomb]
/
rand
/
rand.c
diff --git
a/rand/rand.c
b/rand/rand.c
index
0d0650e
..
665152a
100644
(file)
--- a/
rand/rand.c
+++ b/
rand/rand.c
@@
-428,8
+428,8
@@
void rand_get(rand_pool *r, void *p, size_t sz)
}
}
}
}
- if (r->obits >
sz * 8
)
- r->obits -=
sz * 8
;
+ if (r->obits >
8*sz
)
+ r->obits -=
8*sz
;
else
r->obits = 0;
}
else
r->obits = 0;
}
@@
-467,12
+467,12
@@
void rand_getgood(rand_pool *r, void *p, size_t sz)
while (sz) {
size_t chunk = sz;
while (sz) {
size_t chunk = sz;
- if (
chunk * 8
> r->obits) {
- if (
chunk * 8
> r->ibits + r->obits)
+ if (
8*chunk
> r->obits) {
+ if (
8*chunk
> r->ibits + r->obits)
do r->s->getnoise(r); while (r->ibits + r->obits < 256);
rand_gate(r);
do r->s->getnoise(r); while (r->ibits + r->obits < 256);
rand_gate(r);
- if (
chunk * 8
> r->obits)
- chunk = r->obits
/
8;
+ if (
8*chunk
> r->obits)
+ chunk = r->obits
/
8;
}
if (chunk <= RAND_BUFSZ - r->o) {
}
if (chunk <= RAND_BUFSZ - r->o) {
@@
-484,7
+484,7
@@
void rand_getgood(rand_pool *r, void *p, size_t sz)
rand_stretch(r);
}
rand_stretch(r);
}
- r->obits -=
chunk * 8
;
+ r->obits -=
8*chunk
;
o += chunk;
sz -= chunk;
}
o += chunk;
sz -= chunk;
}