/** * Sets all Bits to 1. */ public void assignAll() { int i; for (i = 0; i < blocks; i++) { value[i] = 0xffffffff; } zeroUnusedBits(); }
/** * Sets all Bits to 1. */ public void assignAll() { int i; for (i = 0; i < blocks; i++) { value[i] = 0xffffffff; } zeroUnusedBits(); }
/** * Fills all len bits of this GF2Polynomial with random values. */ public void randomize() { int i; for (i = 0; i < blocks; i++) { value[i] = rand.nextInt(); } zeroUnusedBits(); }
/** * Fills all len bits of this GF2Polynomial with random values using the * specified source of randomness. * * @param rand the source of randomness */ public void randomize(Random rand) { int i; for (i = 0; i < blocks; i++) { value[i] = rand.nextInt(); } zeroUnusedBits(); }
/** * Fills all len bits of this GF2Polynomial with random values using the * specified source of randomness. * * @param rand the source of randomness */ public void randomize(Random rand) { int i; for (i = 0; i < blocks; i++) { value[i] = rand.nextInt(); } zeroUnusedBits(); }
/** * Fills all len bits of this GF2Polynomial with random values. */ public void randomize() { int i; for (i = 0; i < blocks; i++) { value[i] = rand.nextInt(); } zeroUnusedBits(); }
/** * Computes the bitwise exclusive-or of this GF2Polynomial and <i>b</i> and * stores the result in this GF2Polynomial. <i>b</i> can be of different * size. * * @param b GF2Polynomial */ public void xorThisBy(GF2Polynomial b) { int i; for (i = 0; i < Math.min(blocks, b.blocks); i++) { value[i] ^= b.value[i]; } // If we xor'ed some bits too many by proceeding blockwise, // restore them to zero: zeroUnusedBits(); }
/** * Computes the bitwise exclusive-or of this GF2Polynomial and <i>b</i> and * stores the result in this GF2Polynomial. <i>b</i> can be of different * size. * * @param b GF2Polynomial */ public void xorThisBy(GF2Polynomial b) { int i; for (i = 0; i < Math.min(blocks, b.blocks); i++) { value[i] ^= b.value[i]; } // If we xor'ed some bits too many by proceeding blockwise, // restore them to zero: zeroUnusedBits(); }
/** * Creates a new GF2Polynomial of the given <i>length</i> using the given * int[]. LSB is contained in bs[0]. * * @param length the desired number of bits to store * @param bs contains the desired value, LSB in bs[0] */ public GF2Polynomial(int length, int[] bs) { int leng = length; if (leng < 1) { leng = 1; } blocks = ((leng - 1) >> 5) + 1; value = new int[blocks]; len = leng; int l = Math.min(blocks, bs.length); System.arraycopy(bs, 0, value, 0, l); zeroUnusedBits(); }
/** * Creates a new GF2Polynomial of the given <i>length</i> using the given * int[]. LSB is contained in bs[0]. * * @param length the desired number of bits to store * @param bs contains the desired value, LSB in bs[0] */ public GF2Polynomial(int length, int[] bs) { int leng = length; if (leng < 1) { leng = 1; } blocks = ((leng - 1) >> 5) + 1; value = new int[blocks]; len = leng; int l = Math.min(blocks, bs.length); System.arraycopy(bs, 0, value, 0, l); zeroUnusedBits(); }
zeroUnusedBits(); reduceN();
result.zeroUnusedBits(); return result;
result.zeroUnusedBits(); return result;