PPL  0.12.1
Parma_Polyhedra_Library::Bit_Row Class Reference

A row in a matrix of bits. More...

#include <Bit_Row.defs.hh>

List of all members.

Public Member Functions

 Bit_Row ()
 Default constructor.
 Bit_Row (const Bit_Row &y)
 Copy constructor.
 Bit_Row (const Bit_Row &y, const Bit_Row &z)
 Set-union constructor.
 ~Bit_Row ()
 Destructor.
Bit_Rowoperator= (const Bit_Row &y)
 Assignment operator.
void m_swap (Bit_Row &y)
 Swaps *this with y.
bool operator[] (unsigned long k) const
 Returns the truth value corresponding to the bit in position k.
void set (unsigned long k)
 Sets the bit in position k.
void set_until (unsigned long k)
 Sets bits up to position k (excluded).
void clear (unsigned long k)
 Clears the bit in position k.
void clear_from (unsigned long k)
 Clears bits from position k (included) onward.
void clear ()
 Clears all the bits of the row.
void union_assign (const Bit_Row &x, const Bit_Row &y)
 Assigns to *this the set-theoretic union of x and y.
void intersection_assign (const Bit_Row &x, const Bit_Row &y)
 Assigns to *this the set-theoretic intersection of x and y.
void difference_assign (const Bit_Row &x, const Bit_Row &y)
 Assigns to *this the set-theoretic difference of x and y.
unsigned long first () const
 Returns the index of the first set bit or ULONG_MAX if no bit is set.
unsigned long next (unsigned long position) const
 Returns the index of the first set bit after position or ULONG_MAX if no bit after position is set.
unsigned long last () const
 Returns the index of the last set bit or ULONG_MAX if no bit is set.
unsigned long prev (unsigned long position) const
 Returns the index of the first set bit before position or ULONG_MAX if no bits before position is set.
unsigned long count_ones () const
 Returns the number of set bits in the row.
bool empty () const
 Returns true if no bit is set in the row.
memory_size_type total_memory_in_bytes () const
 Returns the total size in bytes of the memory occupied by *this.
memory_size_type external_memory_in_bytes () const
 Returns the size in bytes of the memory managed by *this.
bool OK () const
 Checks if all the invariants are satisfied.

Private Member Functions

void union_helper (const Bit_Row &y, const Bit_Row &z)
 Assigns to *this the union of y and z.

Private Attributes

mpz_t vec
 Bit-vector representing the row.

Friends

int compare (const Bit_Row &x, const Bit_Row &y)
bool operator== (const Bit_Row &x, const Bit_Row &y)
bool operator!= (const Bit_Row &x, const Bit_Row &y)
bool subset_or_equal (const Bit_Row &x, const Bit_Row &y)
bool subset_or_equal (const Bit_Row &x, const Bit_Row &y, bool &strict_subset)
bool strict_subset (const Bit_Row &x, const Bit_Row &y)

Related Functions

(Note that these are not member functions.)

int compare (const Bit_Row &x, const Bit_Row &y)
bool subset_or_equal (const Bit_Row &x, const Bit_Row &y)
bool subset_or_equal (const Bit_Row &x, const Bit_Row &y, bool &strict_subset)
bool strict_subset (const Bit_Row &x, const Bit_Row &y)
bool operator== (const Bit_Row &x, const Bit_Row &y)
bool operator!= (const Bit_Row &x, const Bit_Row &y)
void swap (Bit_Row &x, Bit_Row &y)
 Swaps x with y.
void iter_swap (std::vector< Bit_Row >::iterator x, std::vector< Bit_Row >::iterator y)
 Swaps objects referred by x and y.
bool operator== (const Bit_Row &x, const Bit_Row &y)
 Returns true if and only if x and y are equal.
bool operator!= (const Bit_Row &x, const Bit_Row &y)
 Returns true if and only if x and y are not equal.
int compare (const Bit_Row &x, const Bit_Row &y)
 The basic comparison function.
bool subset_or_equal (const Bit_Row &x, const Bit_Row &y)
 Set-theoretic inclusion test.
bool subset_or_equal (const Bit_Row &x, const Bit_Row &y, bool &strict_subset)
 Set-theoretic inclusion test: sets strict_subset to a Boolean indicating whether the inclusion is strict or not.
bool strict_subset (const Bit_Row &x, const Bit_Row &y)
 Set-theoretic strict inclusion test.
void swap (Bit_Row &x, Bit_Row &y)
void iter_swap (std::vector< Bit_Row >::iterator x, std::vector< Bit_Row >::iterator y)

Detailed Description

A row in a matrix of bits.

Definition at line 108 of file Bit_Row.defs.hh.


Constructor & Destructor Documentation

Default constructor.

Definition at line 43 of file Bit_Row.inlines.hh.

References vec.

                 {
  mpz_init(vec);
}

Copy constructor.

Definition at line 48 of file Bit_Row.inlines.hh.

References vec.

                                 {
  mpz_init_set(vec, y.vec);
}
Parma_Polyhedra_Library::Bit_Row::Bit_Row ( const Bit_Row y,
const Bit_Row z 
)
inline

Set-union constructor.

Constructs an object containing the set-union of y and z.

Definition at line 53 of file Bit_Row.inlines.hh.

References PPL_ASSERT, PPL_BITS_PER_GMP_LIMB, union_helper(), and vec.

                                                   {
  const mp_size_t y_size = y.vec->_mp_size;
  PPL_ASSERT(y_size >= 0);
  const mp_size_t z_size = z.vec->_mp_size;
  PPL_ASSERT(z_size >= 0);
  if (y_size < z_size) {
    PPL_ASSERT(static_cast<unsigned long>(z_size)
               <= C_Integer<unsigned long>::max / PPL_BITS_PER_GMP_LIMB);
    mpz_init2(vec, static_cast<unsigned long>(z_size) * PPL_BITS_PER_GMP_LIMB);
    union_helper(y, z);
  }
  else {
    PPL_ASSERT(static_cast<unsigned long>(y_size)
               <= C_Integer<unsigned long>::max / PPL_BITS_PER_GMP_LIMB);
    mpz_init2(vec, static_cast<unsigned long>(y_size) * PPL_BITS_PER_GMP_LIMB);
    union_helper(z, y);
  }
}

Destructor.

Definition at line 73 of file Bit_Row.inlines.hh.

References vec.

                  {
  mpz_clear(vec);
}

Member Function Documentation

Clears all the bits of the row.

Definition at line 116 of file Bit_Row.inlines.hh.

References vec.

               {
  mpz_set_ui(vec, 0UL);
}
void Parma_Polyhedra_Library::Bit_Row::clear_from ( unsigned long  k)
inline

Clears bits from position k (included) onward.

Definition at line 94 of file Bit_Row.inlines.hh.

References vec.

                                         {
  mpz_tdiv_r_2exp(vec, vec, k);
}
unsigned long Parma_Polyhedra_Library::Bit_Row::count_ones ( ) const
inline

Returns the number of set bits in the row.

Definition at line 99 of file Bit_Row.inlines.hh.

References PPL_ASSERT, and vec.

Referenced by Parma_Polyhedra_Library::Polyhedron::conversion().

                          {
  mp_size_t x_size = vec->_mp_size;
  PPL_ASSERT(x_size >= 0);
  return (x_size == 0) ? 0 : mpn_popcount(vec->_mp_d, x_size);
}
void Parma_Polyhedra_Library::Bit_Row::difference_assign ( const Bit_Row x,
const Bit_Row y 
)
inline

Assigns to *this the set-theoretic difference of x and y.

Definition at line 156 of file Bit_Row.inlines.hh.

References PPL_DIRTY_TEMP, and vec.

Referenced by Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact().

                                                             {
  PPL_DIRTY_TEMP(mpz_class, complement_y);
  mpz_com(complement_y.get_mpz_t(), y.vec);
  mpz_and(vec, x.vec, complement_y.get_mpz_t());
}

Returns true if no bit is set in the row.

Definition at line 106 of file Bit_Row.inlines.hh.

References vec.

Referenced by Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact(), and Parma_Polyhedra_Library::Polyhedron::simplify_using_context_assign().

                     {
  return mpz_sgn(vec) == 0;
}

Returns the size in bytes of the memory managed by *this.

Definition at line 121 of file Bit_Row.inlines.hh.

References vec.

Referenced by total_memory_in_bytes().

                                        {
  return static_cast<memory_size_type>(vec[0]._mp_alloc) * PPL_SIZEOF_MP_LIMB_T;
}
unsigned long Parma_Polyhedra_Library::Bit_Row::first ( ) const

Returns the index of the first set bit or ULONG_MAX if no bit is set.

Definition at line 32 of file Bit_Row.cc.

References Parma_Polyhedra_Library::Implementation::first_one(), PPL_ASSERT, PPL_BITS_PER_GMP_LIMB, and vec.

Referenced by Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact().

                        {
  const mp_size_t vec_size = vec->_mp_size;
  PPL_ASSERT(vec_size >= 0);
  mp_srcptr p = vec->_mp_d;
  for (mp_size_t li = 0; li < vec_size; ++li, ++p) {
    const mp_limb_t limb = *p;
    if (limb != 0)
      return static_cast<unsigned long>(li) * PPL_BITS_PER_GMP_LIMB
        + Implementation::first_one(limb);
  }
  return C_Integer<unsigned long>::max;
}
void Parma_Polyhedra_Library::Bit_Row::intersection_assign ( const Bit_Row x,
const Bit_Row y 
)
inline

Assigns to *this the set-theoretic intersection of x and y.

Definition at line 151 of file Bit_Row.inlines.hh.

References vec.

Referenced by Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact().

                                                               {
  mpz_and(vec, x.vec, y.vec);
}
unsigned long Parma_Polyhedra_Library::Bit_Row::last ( ) const

Returns the index of the last set bit or ULONG_MAX if no bit is set.

Definition at line 86 of file Bit_Row.cc.

References Parma_Polyhedra_Library::Implementation::last_one(), PPL_ASSERT, and PPL_BITS_PER_GMP_LIMB.

Referenced by Parma_Polyhedra_Library::Bit_Matrix::OK().

                       {
  mp_size_t li = vec->_mp_size;
  PPL_ASSERT(li >= 0);
  if (li == 0)
    return C_Integer<unsigned long>::max;
  --li;
  const mp_srcptr p = vec->_mp_d + li;
  const mp_limb_t limb = *p;
  PPL_ASSERT(limb != 0);
  return static_cast<unsigned long>(li) * PPL_BITS_PER_GMP_LIMB
    + Implementation::last_one(limb);
}

Swaps *this with y.

Definition at line 111 of file Bit_Row.inlines.hh.

References vec.

Referenced by swap().

                          {
  mpz_swap(vec, y.vec);
}
unsigned long Parma_Polyhedra_Library::Bit_Row::next ( unsigned long  position) const

Returns the index of the first set bit after position or ULONG_MAX if no bit after position is set.

Definition at line 46 of file Bit_Row.cc.

References Parma_Polyhedra_Library::Implementation::first_one(), PPL_ASSERT, and PPL_BITS_PER_GMP_LIMB.

Referenced by Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact().

                                             {
  ++position;

  // The alternative implementation using the mpz_scan1() function
  // of GMP was measured to be slower that ours.  Here it is, in
  // case mpz_scan1() is improved.
  //
  // <CODE>
  //   unsigned long r = mpz_scan1(vec, position);
  //   return (r == C_Integer<unsigned long>::max) ? -1 : r;
  // </CODE>

  const unsigned long uli = position / PPL_BITS_PER_GMP_LIMB;
  mp_size_t li = static_cast<mp_size_t>(uli);
  const mp_size_t vec_size = vec->_mp_size;
  PPL_ASSERT(vec_size >= 0);
  if (li >= vec_size)
    return C_Integer<unsigned long>::max;

  // Get the first limb.
  mp_srcptr p = vec->_mp_d + li;

  // Mask off any bits before `position' in the first limb.
  mp_limb_t limb
    = *p & ((~static_cast<mp_limb_t>(0)) << (position % PPL_BITS_PER_GMP_LIMB));

  while (true) {
    if (limb != 0)
      return static_cast<unsigned long>(li) * PPL_BITS_PER_GMP_LIMB
        + Implementation::first_one(limb);
    ++li;
    if (li == vec_size)
      break;
    ++p;
    limb = *p;
  }
  return C_Integer<unsigned long>::max;
}

Checks if all the invariants are satisfied.

Definition at line 309 of file Bit_Row.cc.

Referenced by Parma_Polyhedra_Library::Bit_Matrix::OK().

                     {
  const mp_size_t vec_size = vec->_mp_size;
  const mp_size_t vec_alloc = vec->_mp_alloc;
  return vec_size >= 0
    && vec_alloc >= vec_size
    && (vec_size == 0 || mpz_getlimbn(vec, vec_size-1) != 0);
}
Bit_Row & Parma_Polyhedra_Library::Bit_Row::operator= ( const Bit_Row y)
inline

Assignment operator.

Definition at line 78 of file Bit_Row.inlines.hh.

References vec.

                                   {
  mpz_set(vec, y.vec);
  return *this;
}
bool Parma_Polyhedra_Library::Bit_Row::operator[] ( unsigned long  k) const

Returns the truth value corresponding to the bit in position k.

Definition at line 142 of file Bit_Row.cc.

References PPL_ASSERT.

                                                  {
  const mp_size_t vec_size = vec->_mp_size;
  PPL_ASSERT(vec_size >= 0);

  unsigned long i = k / static_cast<unsigned long>(GMP_NUMB_BITS);
  if (i >= static_cast<unsigned long>(vec_size))
    return false;

  mp_limb_t limb = *(vec->_mp_d + i);
  return ((limb >> (k % static_cast<unsigned long>(GMP_NUMB_BITS))) & 1U) != 0;
}
unsigned long Parma_Polyhedra_Library::Bit_Row::prev ( unsigned long  position) const

Returns the index of the first set bit before position or ULONG_MAX if no bits before position is set.

Definition at line 100 of file Bit_Row.cc.

References Parma_Polyhedra_Library::Implementation::last_one(), PPL_ASSERT, and PPL_BITS_PER_GMP_LIMB.

                                             {
  if (position == 0)
    return C_Integer<unsigned long>::max;

  --position;

  const mp_size_t vec_size = vec->_mp_size;
  PPL_ASSERT(vec_size > 0);
  const unsigned long uli = position / PPL_BITS_PER_GMP_LIMB;
  mp_size_t li = static_cast<mp_size_t>(uli);

  mp_limb_t limb;
  mp_srcptr p = vec->_mp_d;

  // Get the first limb.
  if (li >= vec_size) {
    li = vec_size - 1;
    p += li;
    limb = *p;
  }
  else {
    const mp_limb_t mask
      = (~static_cast<mp_limb_t>(0))
      >> (PPL_BITS_PER_GMP_LIMB - 1U - position % PPL_BITS_PER_GMP_LIMB);
    p += li;
    limb = *p & mask;
  }

  while (true) {
    if (limb != 0)
      return static_cast<unsigned long>(li) * PPL_BITS_PER_GMP_LIMB 
        + Implementation::last_one(limb);
    if (li == 0)
      break;
    --li;
    --p;
    limb = *p;
  }
  return C_Integer<unsigned long>::max;
}

Sets bits up to position k (excluded).

Definition at line 155 of file Bit_Row.cc.

Referenced by Parma_Polyhedra_Library::Polyhedron::BHZ09_C_poly_hull_assign_if_exact(), and Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact().

                                     {
  // FIXME, TODO: this is an inefficient implementation.
  while (k-- > 0)
    mpz_setbit(vec, k);
}

Returns the total size in bytes of the memory occupied by *this.

Definition at line 126 of file Bit_Row.inlines.hh.

References external_memory_in_bytes().

                                     {
  return sizeof(*this) + external_memory_in_bytes();
}
void Parma_Polyhedra_Library::Bit_Row::union_assign ( const Bit_Row x,
const Bit_Row y 
)
inline

Assigns to *this the set-theoretic union of x and y.

Definition at line 131 of file Bit_Row.inlines.hh.

References PPL_ASSERT, PPL_BITS_PER_GMP_LIMB, union_helper(), and vec.

Referenced by Parma_Polyhedra_Library::Polyhedron::BHZ09_C_poly_hull_assign_if_exact(), Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact(), and Parma_Polyhedra_Library::Polyhedron::strongly_minimize_constraints().

                                                        {
  const mp_size_t x_size = x.vec->_mp_size;
  PPL_ASSERT(x_size >= 0);
  const mp_size_t y_size = y.vec->_mp_size;
  PPL_ASSERT(y_size >= 0);
  if (x_size < y_size) {
    PPL_ASSERT(static_cast<unsigned long>(y_size)
               <= C_Integer<unsigned long>::max / PPL_BITS_PER_GMP_LIMB);
    mpz_realloc2(vec, static_cast<unsigned long>(y_size) * PPL_BITS_PER_GMP_LIMB);
    union_helper(x, y);
  }
  else {
    PPL_ASSERT(static_cast<unsigned long>(x_size)
               <= C_Integer<unsigned long>::max / PPL_BITS_PER_GMP_LIMB);
    mpz_realloc2(vec, static_cast<unsigned long>(x_size) * PPL_BITS_PER_GMP_LIMB);
    union_helper(y, x);
  }
}
void Parma_Polyhedra_Library::Bit_Row::union_helper ( const Bit_Row y,
const Bit_Row z 
)
private

Assigns to *this the union of y and z.

The size of y must be be less than or equal to the size of z. Upon entry, vec must have allocated enough space to contain the result.

Definition at line 318 of file Bit_Row.cc.

References PPL_ASSERT, and vec.

Referenced by Bit_Row(), and union_assign().

                                                           {
  mp_size_t y_size = y.vec->_mp_size;
  mp_size_t z_size = z.vec->_mp_size;
  PPL_ASSERT(y_size <= z_size);
  PPL_ASSERT(vec->_mp_alloc >= z_size);
  vec->_mp_size = z.vec->_mp_size;
  mp_srcptr yp = y.vec->_mp_d;
  mp_srcptr zp = z.vec->_mp_d;
  mp_ptr p = vec->_mp_d;
  z_size -= y_size;
  while (y_size > 0) {
    *p = *yp | * zp;
    ++yp;
    ++zp;
    ++p;
    --y_size;
  }
  while (z_size > 0) {
    *p = *zp;
    ++zp;
    ++p;
    --z_size;
  }
}

Friends And Related Function Documentation

int compare ( const Bit_Row x,
const Bit_Row y 
)
related

The basic comparison function.

Compares x with y starting from the least significant bits. The ordering is total and has the following property: if x and y are two rows seen as sets of naturals, if x is a strict subset of y, then x comes before y.

Returns

  • -1 if x comes before y in the ordering;
  • 0 if x and y are equal;
  • 1 if x comes after y in the ordering.
int compare ( const Bit_Row x,
const Bit_Row y 
)
friend
int compare ( const Bit_Row x,
const Bit_Row y 
)
related

Definition at line 163 of file Bit_Row.cc.

References PPL_ASSERT, and vec.

                                               {
  const mp_size_t x_size = x.vec->_mp_size;
  PPL_ASSERT(x_size >= 0);
  const mp_size_t y_size = y.vec->_mp_size;
  PPL_ASSERT(y_size >= 0);
  mp_size_t size = ((x_size > y_size) ? y_size : x_size);
  mp_srcptr xp = x.vec->_mp_d;
  mp_srcptr yp = y.vec->_mp_d;
  while (size > 0) {
    const mp_limb_t xl = *xp;
    const mp_limb_t yl = *yp;
    if (xl != yl) {
      // Get the ones where they are different.
      const mp_limb_t diff = xl ^ yl;
      // First bit that is different.
      const mp_limb_t mask = diff & ~(diff-1);
      return ((xl & mask) != 0) ? 1 : -1;
    }
    ++xp;
    ++yp;
    --size;
  }
  return (x_size == y_size) ? 0 : ((x_size > y_size) ? 1 : -1);
}
void iter_swap ( std::vector< Bit_Row >::iterator  x,
std::vector< Bit_Row >::iterator  y 
)
related

Swaps objects referred by x and y.

void iter_swap ( std::vector< Bit_Row >::iterator  x,
std::vector< Bit_Row >::iterator  y 
)
related

Definition at line 229 of file Bit_Row.inlines.hh.

References Parma_Polyhedra_Library::swap().

                                        {
  swap(*x, *y);
}
bool operator!= ( const Bit_Row x,
const Bit_Row y 
)
related

Returns true if and only if x and y are not equal.

bool operator!= ( const Bit_Row x,
const Bit_Row y 
)
friend
bool operator!= ( const Bit_Row x,
const Bit_Row y 
)
related

Definition at line 296 of file Bit_Row.cc.

References PPL_ASSERT, and vec.

                                                  {
  const mp_size_t x_vec_size = x.vec->_mp_size;
  PPL_ASSERT(x_vec_size >= 0);
  const mp_size_t y_vec_size = y.vec->_mp_size;
  PPL_ASSERT(y_vec_size >= 0);

  if (x_vec_size != y_vec_size)
    return true;

  return mpn_cmp(x.vec->_mp_d, y.vec->_mp_d, x_vec_size) != 0;
}
bool operator== ( const Bit_Row x,
const Bit_Row y 
)
related

Returns true if and only if x and y are equal.

bool operator== ( const Bit_Row x,
const Bit_Row y 
)
friend
bool operator== ( const Bit_Row x,
const Bit_Row y 
)
related

Definition at line 282 of file Bit_Row.cc.

References PPL_ASSERT, and vec.

                                                  {
  const mp_size_t x_vec_size = x.vec->_mp_size;
  PPL_ASSERT(x_vec_size >= 0);
  const mp_size_t y_vec_size = y.vec->_mp_size;
  PPL_ASSERT(y_vec_size >= 0);

  if (x_vec_size != y_vec_size)
    return false;

  return mpn_cmp(x.vec->_mp_d, y.vec->_mp_d, x_vec_size) == 0;
}
bool strict_subset ( const Bit_Row x,
const Bit_Row y 
)
related

Set-theoretic strict inclusion test.

bool strict_subset ( const Bit_Row x,
const Bit_Row y 
)
friend
bool strict_subset ( const Bit_Row x,
const Bit_Row y 
)
related

Definition at line 256 of file Bit_Row.cc.

References PPL_ASSERT, and vec.

                                                     {
  mp_size_t x_size = x.vec->_mp_size;
  PPL_ASSERT(x_size >= 0);
  mp_size_t y_size = y.vec->_mp_size;
  PPL_ASSERT(y_size >= 0);
  if (x_size > y_size)
    return false;
  bool different = (x_size < y_size);
  mp_srcptr xp = x.vec->_mp_d;
  mp_srcptr yp = y.vec->_mp_d;
  while (x_size > 0) {
    const mp_limb_t xl = *xp;
    const mp_limb_t yl = *yp;
    if ((xl & ~yl) != 0)
      return false;
    if (!different && xl != yl)
      different = true;
    ++xp;
    ++yp;
    --x_size;
  }
  return different;
}
bool subset_or_equal ( const Bit_Row x,
const Bit_Row y 
)
related

Set-theoretic inclusion test.

bool subset_or_equal ( const Bit_Row x,
const Bit_Row y,
bool &  strict_subset 
)
related

Set-theoretic inclusion test: sets strict_subset to a Boolean indicating whether the inclusion is strict or not.

bool subset_or_equal ( const Bit_Row x,
const Bit_Row y 
)
friend
bool subset_or_equal ( const Bit_Row x,
const Bit_Row y,
bool &  strict_subset 
)
friend
bool subset_or_equal ( const Bit_Row x,
const Bit_Row y 
)
related

Definition at line 190 of file Bit_Row.cc.

References PPL_ASSERT, and vec.

                                                       {
  mp_size_t x_size = x.vec->_mp_size;
  PPL_ASSERT(x_size >= 0);
  mp_size_t y_size = y.vec->_mp_size;
  PPL_ASSERT(y_size >= 0);
  if (x_size > y_size)
    return false;
  mp_srcptr xp = x.vec->_mp_d;
  mp_srcptr yp = y.vec->_mp_d;
  while (x_size > 0) {
    if ((*xp & ~*yp) != 0)
      return false;
    ++xp;
    ++yp;
    --x_size;
  }
  return true;
}
bool subset_or_equal ( const Bit_Row x,
const Bit_Row y,
bool &  strict_subset 
)
related

Definition at line 211 of file Bit_Row.cc.

References PPL_ASSERT, and vec.

                                          {
  mp_size_t x_size = x.vec->_mp_size;
  PPL_ASSERT(x_size >= 0);
  mp_size_t y_size = y.vec->_mp_size;
  PPL_ASSERT(y_size >= 0);
  if (x_size > y_size)
    return false;
  mp_srcptr xp = x.vec->_mp_d;
  mp_srcptr yp = y.vec->_mp_d;
  strict_subset = (x_size < y_size);
  mp_limb_t xl;
  mp_limb_t yl;
  if (strict_subset) {
    while (x_size > 0) {
      xl = *xp;
      yl = *yp;
      if ((xl & ~yl) != 0)
        return false;
    strict_subset_next:
      ++xp;
      ++yp;
      --x_size;
    }
  }
  else {
    while (x_size > 0) {
      xl = *xp;
      yl = *yp;
      if (xl != yl) {
        if ((xl & ~yl) != 0)
          return false;
        strict_subset = true;
        goto strict_subset_next;
      }
      ++xp;
      ++yp;
      --x_size;
    }
  }
  return true;
}
void swap ( Bit_Row x,
Bit_Row y 
)
related

Swaps x with y.

void swap ( Bit_Row x,
Bit_Row y 
)
related

Definition at line 223 of file Bit_Row.inlines.hh.

References m_swap().

                             {
  x.m_swap(y);
}

Member Data Documentation


The documentation for this class was generated from the following files: