From 5c26dd04dd171112d14bfb24db96cf286566e19b Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Tue, 9 Feb 2016 21:36:34 -0200 Subject: Slightly reworked rewinding; added values rewinding. Needs a solution to the problem of which values must be displayed and/or interpolated. Currently, whenever the user rewinds, the current error measure is displayed, regardless of what was being displayed before. This will probably be trivial to solve once we have a nice way of changing the current measure. * Also changed all OpenMP-powered for loops to use signed integers, requirements of OMP2.x (which is what MSVC supports currently) * The above change comes with a new header for utility functions --- utils.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 utils.h (limited to 'utils.h') diff --git a/utils.h b/utils.h new file mode 100644 index 0000000..ba13f27 --- /dev/null +++ b/utils.h @@ -0,0 +1,19 @@ +#include +#include + +/* + * Credits to: + * http://stackoverflow.com/questions/13150449/efficient-unsigned-to-signed-cast-avoiding-implementation-defined-behavior + */ +template +Int uintToInt(Uint x) +{ + if (x <= std::numeric_limits::max()) + return static_cast(x); + + if (x >= std::numeric_limits::min()) + return static_cast(x - std::numeric_limits::min()) + + std::numeric_limits::min(); + + throw std::overflow_error("given value does not fit integer type"); +} -- cgit v1.2.3