Skip to content

Commit

Permalink
Merge pull request MarlinFirmware#4342 from gudnimg/optimsation_timer…
Browse files Browse the repository at this point in the history
…_class

optimisation: Timer constructor can be `constexpr`
  • Loading branch information
3d-gussner authored Sep 13, 2023
2 parents 9781e15 + a89e06a commit f5d48cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
11 changes: 0 additions & 11 deletions Firmware/Timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,6 @@
#include "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
*/
Expand Down
5 changes: 4 additions & 1 deletion Firmware/Timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ template <class T>
class Timer
{
public:
Timer();
inline constexpr Timer()
: m_isRunning(false)
, m_started(0) {};

void start();
void stop(){m_isRunning = false;}
bool running()const {return m_isRunning;}
Expand Down

0 comments on commit f5d48cd

Please sign in to comment.