public void add_bits (int bitstring, int length)
  {
  	int bitmask = 1 << (length - 1);
  	do
	 if (((crc & 0x8000) == 0) ^ ((bitstring & bitmask) == 0 ))
	 {
		crc <<= 1;
		crc ^= polynomial;
	 }
	 else
		crc <<= 1;
  	while ((bitmask >>>= 1) != 0);
  }