Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base > Class Template Reference

#include <Interval_Restriction.defs.hh>

Inheritance diagram for Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >:

Inheritance graph
[legend]
Collaboration diagram for Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >:

Collaboration graph
[legend]

List of all members.

Public Types

typedef T modulo_type

Public Member Functions

 COMPILE_TIME_CHECK (std::numeric_limits< T >::is_exact,"Type for modulo values must be exact.")
 Interval_Restriction_Integer_Modulo ()
bool has_restriction () const
void clear ()
void normalize () const
template<typename V>
Result restrict (V &x, Result dir) const
void assign_or_swap (Interval_Restriction_Integer_Modulo &x)

Public Attributes

remainder
divisor


Detailed Description

template<typename T, typename Base>
class Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >

Definition at line 315 of file Interval_Restriction.defs.hh.


Member Typedef Documentation

template<typename T, typename Base>
typedef T Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::modulo_type

Definition at line 392 of file Interval_Restriction.defs.hh.


Constructor & Destructor Documentation

template<typename T, typename Base>
Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::Interval_Restriction_Integer_Modulo (  )  [inline]

Definition at line 318 of file Interval_Restriction.defs.hh.

References Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::clear().

00318                                         {
00319     // FIXME: would we have speed benefits with uninitialized info?
00320     // (Dirty_Temp)
00321     clear();
00322   }


Member Function Documentation

template<typename T, typename Base>
Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::COMPILE_TIME_CHECK ( std::numeric_limits< T >::is_exact  ,
"Type for modulo values must be exact."   
)

template<typename T, typename Base>
bool Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::has_restriction (  )  const [inline]

template<typename T, typename Base>
void Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::clear (  )  [inline]

template<typename T, typename Base>
void Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::normalize (  )  const [inline]

Definition at line 331 of file Interval_Restriction.defs.hh.

00331                          {
00332   }

template<typename T, typename Base>
template<typename V>
Result Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::restrict ( V &  x,
Result  dir 
) const [inline]

Definition at line 334 of file Interval_Restriction.defs.hh.

References Parma_Polyhedra_Library::assign_r(), Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::divisor, and Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::has_restriction().

00334                                           {
00335     if (!has_restriction())
00336       return dir;
00337     DIRTY_TEMP(V, n);
00338     DIRTY_TEMP(V, div);
00339     Result r;
00340     r = assign_r(div, divisor, ROUND_CHECK);
00341     assert(r == V_EQ);
00342     int s;
00343     r = rem_assign_r(n, x, div, ROUND_NOT_NEEDED);
00344     assert(r == V_EQ);
00345     s = sgn(n);
00346     switch (dir) {
00347     case V_GT:
00348       if (s >= 0) {
00349         r = sub_assign_r(n, div, n, ROUND_NOT_NEEDED);
00350         assert(r == V_EQ);
00351         return add_assign_r(x, x, n, ROUND_DOWN);
00352       }
00353       else
00354         return sub_assign_r(x, x, n, ROUND_DOWN);
00355     case V_GE:
00356       if (s > 0) {
00357         r = sub_assign_r(n, div, n, ROUND_NOT_NEEDED);
00358         assert(r == V_EQ);
00359         return add_assign_r(x, x, n, ROUND_DOWN);
00360       }
00361       else if (s < 0)
00362         return sub_assign_r(x, x, n, ROUND_DOWN);
00363       else
00364         return V_EQ;
00365     case V_LT:
00366       if (s <= 0) {
00367         r = add_assign_r(n, div, n, ROUND_NOT_NEEDED);
00368         assert(r == V_EQ);
00369         return sub_assign_r(x, x, n, ROUND_UP);
00370       }
00371       else
00372         return sub_assign_r(x, x, n, ROUND_UP);
00373     case V_LE:
00374       if (s < 0) {
00375         r = add_assign_r(n, div, n, ROUND_NOT_NEEDED);
00376         assert(r == V_EQ);
00377         return sub_assign_r(x, x, n, ROUND_UP);
00378       }
00379       else if (s > 0)
00380         return sub_assign_r(x, x, n, ROUND_UP);
00381       else
00382         return V_EQ;
00383     default:
00384       assert(false);
00385       return dir;
00386     }
00387   }

template<typename T, typename Base>
void Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::assign_or_swap ( Interval_Restriction_Integer_Modulo< T, Base > &  x  )  [inline]

Definition at line 388 of file Interval_Restriction.defs.hh.

References Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::divisor, and Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::remainder.

00388                                                               {
00389     Parma_Polyhedra_Library::assign_or_swap(remainder, x.remainder);
00390     Parma_Polyhedra_Library::assign_or_swap(divisor, x.divisor);
00391   }


Member Data Documentation

template<typename T, typename Base>
T Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::remainder

template<typename T, typename Base>
T Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::divisor


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

Generated on Sat Oct 11 10:41:11 2008 for PPL by  doxygen 1.5.6