bool ternary::encode(const int_vector &v, int_vector &z){ z.setIntWidth( v.getIntWidth() ); size_t z_bit_size = 0; for(typename int_vector::const_iterator it = v.begin(), end = v.end(); it != end; ++it){ z_bit_size += encoding_length(*it); } z.bit_resize( z_bit_size ); // Initial size of z if( z_bit_size & 0x3F ){ // if z_bit_size % 64 != 0 *(z.m_data + (z_bit_size>>6)) = 0; // initialize last word }