+ * Create a bignum which is the bitmask covering another one. That
+ * is, the smallest integer which is >= N and is also one less than
+ * a power of two.
+ */
+Bignum bignum_bitmask(Bignum n) {
+ Bignum ret = copybn(n);
+ int i;
+ unsigned short j;
+
+ i = ret[0];
+ while (n[i] == 0 && i > 0)
+ i--;
+ if (i <= 0)
+ return ret; /* input was zero */
+ j = 1;
+ while (j < n[i])
+ j = 2*j+1;
+ ret[i] = j;
+ while (--i > 0)
+ ret[i] = 0xFFFF;
+ return ret;
+}
+
+/*