24 #ifndef PPL_globals_inlines_hh
25 #define PPL_globals_inlines_hh 1
39 return std::numeric_limits<dimension_type>::max();
46 return static_cast<int32_t
>(dim);
61 if ((std::numeric_limits<Delta>::max() >> scale) < unscaled) {
62 throw std::invalid_argument(
"PPL::Weightwatch_Traits::"
63 "compute_delta(u, s):\n"
64 "values of u and s cause wrap around.");
66 return static_cast<Delta>(unscaled) << scale;
71 threshold =
weight + delta;
92 assert(requested_size <= maximum_size);
94 return (requested_size < maximum_size/2)
95 ? (2*(requested_size + 1))
103 template <
typename T>
110 template <
typename T>
120 * PPL_SIZEOF_MP_LIMB_T;
169 return isspace(c) != 0;
172 template <
typename RA_Container>
173 inline typename RA_Container::iterator
175 typedef typename RA_Container::difference_type diff_t;
176 return cont.begin() +
static_cast<diff_t
>(n);
179 template <
typename RA_Container>
180 inline typename RA_Container::const_iterator
182 typedef typename RA_Container::difference_type diff_t;
183 return cont.begin() +
static_cast<diff_t
>(n);
188 return i & (~i + 1U);
193 #endif // !defined(PPL_globals_inlines_hh)
size_t dimension_type
An unsigned integral type for representing space dimensions.
Enable_If< Is_Native_Or_Checked< T >::value, void >::type ascii_dump(std::ostream &s, const T &t)
unsigned long long Threshold
The type used to specify thresholds for computational weight.
dimension_type not_a_dimension()
Returns a value that does not designate a valid dimension.
static bool less_than(const Threshold &a, const Threshold &b)
Compares the two weights a and b.
bool is_space(char c)
Returns true if c is any kind of space character.
RA_Container::iterator nth_iter(RA_Container &cont, dimension_type n)
dimension_type compute_capacity(dimension_type requested_size, dimension_type maximum_size)
Speculative allocation function.
unsigned long long Delta
The type used to specify increments of computational weight.
#define sizeof_to_bits(size)
Enable_If< Is_Native< T >::value, memory_size_type >::type external_memory_in_bytes(const T &)
For native types, returns the size in bytes of the memory managed by the type of the (unused) paramet...
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type ascii_load(std::istream &s, T &t)
static const Threshold & get()
Returns the current computational weight.
int32_t hash_code_from_dimension(dimension_type dim)
Returns the hash code for space dimension dim.
static Threshold weight
The current computational weight.
The entire library is confined to this namespace.
Dense representation: the coefficient sequence is represented as a vector of coefficients, including the zero coefficients. If there are only a few nonzero coefficients, this representation is faster and also uses a bit less memory.
static void(* check_function)(void)
A pointer to the function that has to be called when checking the reaching of thresholds.
Sparse representation: only the nonzero coefficient are stored. If there are many nonzero coefficient...
static void from_delta(Threshold &threshold, const Delta &delta)
Sets threshold to be delta units bigger than the current weight.
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
const Throwable *volatile abandon_expensive_computations
A pointer to an exception object.
Enable_If< Is_Native< T >::value, memory_size_type >::type total_memory_in_bytes(const T &)
For native types, returns the total size in bytes of the memory occupied by the type of the (unused) ...
User objects the PPL can throw.
dimension_type least_significant_one_mask(dimension_type i)
static Delta compute_delta(unsigned long unscaled, unsigned scale)
Computes a Delta value from unscaled and scale.