From 9056422bf208fef99e3cbdc2acd7bf59a0f998e0 Mon Sep 17 00:00:00 2001 From: Sebastien Gilles <sebastien.gilles@inria.fr> Date: Mon, 13 May 2019 10:55:02 +0200 Subject: [PATCH] Exercice 39 solution now compiles... --- TP/4-Templates/Solution/exercice39.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/TP/4-Templates/Solution/exercice39.cpp b/TP/4-Templates/Solution/exercice39.cpp index c1ab83b..672d3d6 100644 --- a/TP/4-Templates/Solution/exercice39.cpp +++ b/TP/4-Templates/Solution/exercice39.cpp @@ -184,9 +184,9 @@ IntT operator*(const PowerOfTwoApprox<IntT>& approx, IntT coefficient) bool is_overflow { false }; // static_cast for the sake of `short` case: short + short -> int! - IntT ret = static_cast<IntT>(times_power_of_2<IntT>(is_overflow, - approx.Numerator() * coefficient, - -approx.Exponent())); + IntT ret = static_cast<IntT>(times_power_of_2(is_overflow, + approx.Numerator() * coefficient, + -approx.Exponent())); if (is_overflow) { @@ -438,7 +438,6 @@ void TestDisplaySum<IntT>::Display(int Nbits, double value1, IntT coefficient1, // Ugly trick to circumvent the fact we can't add a new argument to operator* to get the value of `overflow` // boolean. Fortunately we'll see a bit later how to deal properly with this. - bool is_overflow { false }; if (approx == std::numeric_limits<IntT>::max()) is_overflow = true; -- GitLab