Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

Commit 4c12e8b0 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

TP: fixes (including unused lines...) found thanks to gcc.

parent c15f50a1
......@@ -8,12 +8,12 @@ include(../../cmake/AfterProjectSettings.cmake)
add_executable(initial initial_file.cpp)
add_executable(exercice35 exercice35.cpp)
add_executable(exercice36 exercice36.cpp)
add_executable(exercice37_struct exercice37_struct.cpp)
add_executable(exercice37_constexpr exercice37_constexpr.cpp)
add_executable(exercice38 exercice38.cpp)
add_executable(exercice39 exercice39.cpp)
add_executable(exercice40 exercice40.cpp)
add_executable(exercice41 exercice41.cpp)
add_executable(exercice42 exercice42.cpp)
\ No newline at end of file
# add_executable(exercice35 exercice35.cpp)
# add_executable(exercice36 exercice36.cpp)
# add_executable(exercice37_struct exercice37_struct.cpp)
# add_executable(exercice37_constexpr exercice37_constexpr.cpp)
# add_executable(exercice38 exercice38.cpp)
# add_executable(exercice39 exercice39.cpp)
# add_executable(exercice40 exercice40.cpp)
# add_executable(exercice41 exercice41.cpp)
# add_executable(exercice42 exercice42.cpp)
\ No newline at end of file
......@@ -73,18 +73,8 @@ const char* Error::what() const noexcept
template<class IntT>
IntT times_power_of_2(IntT number, int exponent)
{
constexpr IntT one = static_cast<IntT>(1);
constexpr IntT two = static_cast<IntT>(2);
IntT sign = one;
if (number < 0)
{
sign = -one;
number = -number;
};
while (exponent > 0)
{
IntT product;
......@@ -104,7 +94,7 @@ IntT times_power_of_2(IntT number, int exponent)
exponent += 1 ;
}
return one * number;
return number;
}
......
......@@ -74,18 +74,8 @@ const char* Error::what() const noexcept
template<class IntT>
IntT times_power_of_2(IntT number, int exponent)
{
constexpr IntT one = static_cast<IntT>(1);
constexpr IntT two = static_cast<IntT>(2);
IntT sign = one;
if (number < 0)
{
sign = -one;
number = -number;
};
while (exponent > 0)
{
IntT product;
......@@ -105,7 +95,7 @@ IntT times_power_of_2(IntT number, int exponent)
exponent += 1 ;
}
return one * number;
return number;
}
......
......@@ -75,18 +75,8 @@ const char* Error::what() const noexcept
template<class IntT>
IntT times_power_of_2(IntT number, int exponent)
{
constexpr IntT one = static_cast<IntT>(1);
constexpr IntT two = static_cast<IntT>(2);
IntT sign = one;
if (number < 0)
{
sign = -one;
number = -number;
};
while (exponent > 0)
{
IntT product;
......@@ -106,7 +96,7 @@ IntT times_power_of_2(IntT number, int exponent)
exponent += 1 ;
}
return one * number;
return number;
}
......
......@@ -75,18 +75,8 @@ const char* Error::what() const noexcept
template<class IntT>
IntT times_power_of_2(IntT number, int exponent)
{
constexpr IntT one = static_cast<IntT>(1);
constexpr IntT two = static_cast<IntT>(2);
IntT sign = one;
if (number < 0)
{
sign = -one;
number = -number;
};
while (exponent > 0)
{
IntT product;
......@@ -106,7 +96,7 @@ IntT times_power_of_2(IntT number, int exponent)
exponent += 1 ;
}
return one * number;
return number;
}
......
......@@ -75,18 +75,8 @@ const char* Error::what() const noexcept
template<class IntT>
IntT times_power_of_2(IntT number, int exponent)
{
constexpr IntT one = static_cast<IntT>(1);
constexpr IntT two = static_cast<IntT>(2);
IntT sign = one;
if (number < 0)
{
sign = -one;
number = -number;
};
while (exponent > 0)
{
IntT product;
......@@ -106,7 +96,7 @@ IntT times_power_of_2(IntT number, int exponent)
exponent += 1 ;
}
return one * number;
return number;
}
......
......@@ -8,4 +8,4 @@ include(../../cmake/AfterProjectSettings.cmake)
add_executable(initial initial_file.cpp)
include(${CMAKE_CURRENT_LIST_DIR}/Exercice43/CMakeLists.txt)
#include(${CMAKE_CURRENT_LIST_DIR}/Exercice43/CMakeLists.txt)
#ifndef POWER_OF_TWO_APPROX_HPP
#define POWER_OF_TWO_APPROX_HPP
#include <cassert>
#include <iostream>
#include <string>
......
......@@ -16,18 +16,8 @@ inline auto PrintInt(T value)
template<class IntT>
IntT times_power_of_2(IntT number, int exponent)
{
constexpr IntT one = static_cast<IntT>(1);
constexpr IntT two = static_cast<IntT>(2);
IntT sign = one;
if (number < 0)
{
sign = -one;
number = -number;
};
while (exponent > 0)
{
IntT product;
......@@ -47,7 +37,7 @@ IntT times_power_of_2(IntT number, int exponent)
exponent += 1 ;
}
return one * number;
return number;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment