diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-08-26 05:44:26 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-08-26 05:44:26 +0200 |
commit | 844bbecadb3a4263a183ce03021849ac41cbd20f (patch) | |
tree | 5dbcfc8b9c6e03d5d8d613cbdc06591eef96664e /sys/src/libmp | |
parent | 8f2e408448c2c2d16173f244448b8b9a1fcaf6d7 (diff) |
libmp: simplify mpnrand(), as mpnew() cannot return nil
Diffstat (limited to 'sys/src/libmp')
-rw-r--r-- | sys/src/libmp/port/mpnrand.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/sys/src/libmp/port/mpnrand.c b/sys/src/libmp/port/mpnrand.c index 34ca63a2f..600283d9d 100644 --- a/sys/src/libmp/port/mpnrand.c +++ b/sys/src/libmp/port/mpnrand.c @@ -13,16 +13,11 @@ mpnrand(mpint *n, void (*gen)(uchar*, int), mpint *b) /* m = 2^bits - 1 */ bits = mpsignif(n); m = mpnew(bits+1); - if(m == nil) - sysfatal("mpnrand: %r"); mpleft(mpone, bits, m); mpsub(m, mpone, m); - if(b == nil){ + if(b == nil) b = mpnew(bits); - if(b == nil) - sysfatal("mpnrand: %r"); - } /* m = m - (m % n) */ mpmod(m, n, b); |