optimisation: Timer constructor can be constexpr
Change in memory: Flash: -206 bytes SRAM: -16 bytes
This commit is contained in:
parent
2a71e681db
commit
a89e06a54e
|
|
@ -6,17 +6,6 @@
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#include "system_timer.h"
|
#include "system_timer.h"
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief construct Timer
|
|
||||||
*
|
|
||||||
* It is guaranteed, that construction is equivalent with zeroing all members.
|
|
||||||
* This property can be exploited in menu_data.
|
|
||||||
*/
|
|
||||||
template<typename T>
|
|
||||||
Timer<T>::Timer() : m_isRunning(false), m_started()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Start timer
|
* @brief Start timer
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,10 @@ template <class T>
|
||||||
class Timer
|
class Timer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Timer();
|
inline constexpr Timer()
|
||||||
|
: m_isRunning(false)
|
||||||
|
, m_started(0) {};
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
void stop(){m_isRunning = false;}
|
void stop(){m_isRunning = false;}
|
||||||
bool running()const {return m_isRunning;}
|
bool running()const {return m_isRunning;}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue