#include <Interval_Restriction.defs.hh>
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 | |
T | remainder |
T | divisor |
Definition at line 315 of file Interval_Restriction.defs.hh.
typedef T Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::modulo_type |
Definition at line 392 of file Interval_Restriction.defs.hh.
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 }
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." | ||||
) |
bool Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::has_restriction | ( | ) | const [inline] |
Definition at line 323 of file Interval_Restriction.defs.hh.
References Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::divisor.
Referenced by Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::restrict().
00323 { 00324 return divisor != 0; 00325 }
void Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::clear | ( | ) | [inline] |
Definition at line 326 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.
Referenced by Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::Interval_Restriction_Integer_Modulo().
void Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::normalize | ( | ) | const [inline] |
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 }
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 }
T Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::remainder |
Definition at line 393 of file Interval_Restriction.defs.hh.
Referenced by Parma_Polyhedra_Library::add_restriction(), Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::assign_or_swap(), Parma_Polyhedra_Library::assign_restriction(), Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::clear(), Parma_Polyhedra_Library::intersect_restriction(), Parma_Polyhedra_Library::join_restriction(), Parma_Polyhedra_Library::mul_restriction(), Parma_Polyhedra_Library::output_restriction(), Parma_Polyhedra_Library::set_integer(), Parma_Polyhedra_Library::set_unrestricted(), and Parma_Polyhedra_Library::sub_restriction().
T Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::divisor |
Definition at line 394 of file Interval_Restriction.defs.hh.
Referenced by Parma_Polyhedra_Library::add_restriction(), Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::assign_or_swap(), Parma_Polyhedra_Library::assign_restriction(), Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::clear(), Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::has_restriction(), Parma_Polyhedra_Library::intersect_restriction(), Parma_Polyhedra_Library::join_restriction(), Parma_Polyhedra_Library::mul_restriction(), Parma_Polyhedra_Library::output_restriction(), Parma_Polyhedra_Library::Interval_Restriction_Integer_Modulo< T, Base >::restrict(), Parma_Polyhedra_Library::set_integer(), Parma_Polyhedra_Library::set_unrestricted(), and Parma_Polyhedra_Library::sub_restriction().