ref: 844bbecadb3a4263a183ce03021849ac41cbd20f
parent: 8f2e408448c2c2d16173f244448b8b9a1fcaf6d7
author: cinap_lenrek <[email protected]>
date: Wed Aug 26 01:44:26 EDT 2015
libmp: simplify mpnrand(), as mpnew() cannot return nil
--- a/sys/src/libmp/port/mpnrand.c
+++ b/sys/src/libmp/port/mpnrand.c
@@ -13,16 +13,11 @@
/* 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);