~mdw
/
catacomb
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
54d36e7
)
rand/dsarand.c: Return the old number of passes from `DSARAND_PASSES'.
author
Mark Wooding
<mdw@distorted.org.uk>
Sat, 16 Nov 2019 17:12:16 +0000
(17:12 +0000)
committer
Mark Wooding
<mdw@distorted.org.uk>
Sat, 9 May 2020 19:57:33 +0000
(20:57 +0100)
Also, don't update if the input operand is zero.
rand/dsarand.c
patch
|
blob
|
blame
|
history
diff --git
a/rand/dsarand.c
b/rand/dsarand.c
index
70ffaf8
..
a4328aa
100644
(file)
--- a/
rand/dsarand.c
+++ b/
rand/dsarand.c
@@
-282,9
+282,11
@@
static int gmisc(grand *r, unsigned op, ...)
grand *rr = va_arg(ap, grand *);
rr->ops->fill(rr, g->d.p, g->d.sz);
} break;
- case DSARAND_PASSES:
- g->d.passes = va_arg(ap, unsigned);
- break;
+ case DSARAND_PASSES: {
+ unsigned n = va_arg(ap, unsigned);
+ rc = g->d.passes;
+ if (n > 0) g->d.passes = n;
+ } break;
case DSARAND_SEEDSZ:
rc = g->d.sz;
break;