00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef PPL_globals_inlines_hh
00024 #define PPL_globals_inlines_hh 1
00025
00026 #include "Coefficient.defs.hh"
00027 #include <limits>
00028 #include <cassert>
00029
00030 namespace Parma_Polyhedra_Library {
00031
00032 inline dimension_type
00033 not_a_dimension() {
00034 return std::numeric_limits<dimension_type>::max();
00035 }
00036
00037 inline
00038 Throwable::~Throwable() {
00039 }
00040
00041 inline void
00042 maybe_abandon() {
00043 if (const Throwable* p = abandon_expensive_computations)
00044 p->throw_me();
00045 }
00046
00047 inline dimension_type
00048 compute_capacity(const dimension_type requested_size,
00049 const dimension_type maximum_size) {
00050 assert(requested_size <= maximum_size);
00051
00052 return (requested_size < maximum_size / 2)
00053 ? 2*(requested_size + 1)
00054 : maximum_size;
00055
00056
00057
00058
00059 }
00060
00061 inline void
00062 normalize2(Coefficient_traits::const_reference x,
00063 Coefficient_traits::const_reference y,
00064 Coefficient& nx, Coefficient& ny) {
00065 TEMP_INTEGER(gcd);
00066 gcd_assign(gcd, x, y);
00067 exact_div_assign(nx, x, gcd);
00068 exact_div_assign(ny, y, gcd);
00069 }
00070
00071 template <typename T>
00072 inline T
00073 low_bits_mask(const unsigned n) {
00074 assert(n < unsigned(std::numeric_limits<T>::digits));
00075 return n == 0 ? 0 : ~(~(T(0u)) << n);
00076 }
00077
00078 }
00079
00080 #endif // !defined(PPL_globals_inlines_hh)