24 #ifndef PPL_Bit_Row_inlines_hh
25 #define PPL_Bit_Row_inlines_hh 1
29 #include "assertions.hh"
32 #if defined(PPL_HAVE_STRINGS_H)
34 #elif defined(PPL_HAVE_STRING_H)
38 #define PPL_BITS_PER_GMP_LIMB sizeof_to_bits(PPL_SIZEOF_MP_LIMB_T)
54 const mp_size_t y_size = y.
vec->_mp_size;
55 PPL_ASSERT(y_size >= 0);
56 const mp_size_t z_size = z.
vec->_mp_size;
57 PPL_ASSERT(z_size >= 0);
58 if (y_size < z_size) {
59 PPL_ASSERT(static_cast<unsigned long>(z_size)
65 PPL_ASSERT(static_cast<unsigned long>(y_size)
95 mpz_tdiv_r_2exp(
vec,
vec, k);
100 const mp_size_t x_size =
vec->_mp_size;
101 PPL_ASSERT(x_size >= 0);
102 return (x_size == 0) ? 0 : mpn_popcount(
vec->_mp_d, x_size);
107 return mpz_sgn(
vec) == 0;
117 mpz_set_ui(
vec, 0UL);
132 const mp_size_t x_size = x.
vec->_mp_size;
133 PPL_ASSERT(x_size >= 0);
134 const mp_size_t y_size = y.
vec->_mp_size;
135 PPL_ASSERT(y_size >= 0);
136 if (x_size < y_size) {
137 PPL_ASSERT(static_cast<unsigned long>(y_size)
143 PPL_ASSERT(static_cast<unsigned long>(x_size)
158 mpz_com(complement_y.get_mpz_t(), y.
vec);
159 mpz_and(
vec, x.
vec, complement_y.get_mpz_t());
162 namespace Implementation {
230 std::vector<Bit_Row>::iterator y) {
236 #endif // !defined(PPL_Bit_Row_inlines_hh)
void swap(CO_Tree &x, CO_Tree &y)
void swap(Bit_Row &x, Bit_Row &y)
void intersection_assign(const Bit_Row &x, const Bit_Row &y)
Assigns to *this the set-theoretic intersection of x and y.
void union_assign(const Bit_Row &x, const Bit_Row &y)
Assigns to *this the set-theoretic union of x and y.
unsigned int ctz(unsigned int u)
Bit_Row & operator=(const Bit_Row &y)
Assignment operator.
void set(unsigned long k)
Sets the bit in position k.
void difference_assign(const Bit_Row &x, const Bit_Row &y)
Assigns to *this the set-theoretic difference of x and y.
unsigned long count_ones() const
Returns the number of set bits in the row.
memory_size_type total_memory_in_bytes() const
Returns the total size in bytes of the memory occupied by *this.
A row in a matrix of bits.
mpz_t vec
Bit-vector representing the row.
unsigned int last_one(unsigned int u)
Assuming u is nonzero, returns the index of the last set bit in u.
#define sizeof_to_bits(size)
bool empty() const
Returns true if no bit is set in the row.
void m_swap(Bit_Row &y)
Swaps *this with y.
#define PPL_DIRTY_TEMP(T, id)
void clear()
Clears all the bits of the row.
void clear_from(unsigned long k)
Clears bits from position k (included) onward.
void iter_swap(std::vector< Bit_Row >::iterator x, std::vector< Bit_Row >::iterator y)
The entire library is confined to this namespace.
#define PPL_BITS_PER_GMP_LIMB
unsigned int clz(unsigned int u)
Bit_Row()
Default constructor.
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
unsigned int first_one(unsigned int u)
Assuming u is nonzero, returns the index of the first set bit in u.
void union_helper(const Bit_Row &y, const Bit_Row &z)
Assigns to *this the union of y and z.