Skip to content

Commit

Permalink
Force gcc inlining, use same style for getCycleCount as for getCpuFre…
Browse files Browse the repository at this point in the history
…qMHz.
  • Loading branch information
dok-net committed Aug 31, 2020
1 parent 400632f commit c74dcc9
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions cores/esp8266/Esp.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class EspClass {
#if defined(F_CPU) || defined(CORE_MOCK)
constexpr
#endif
uint8_t getCpuFreqMHz() const
inline uint8_t getCpuFreqMHz() const __attribute__((always_inline))
{
return esp_get_cpu_freq_mhz();
}
Expand Down Expand Up @@ -166,21 +166,15 @@ class EspClass {
uint8_t *random(uint8_t *resultArray, const size_t outputSizeBytes) const;
uint32_t random() const;

#ifndef CORE_MOCK
inline uint32_t getCycleCount() __attribute__((always_inline));
#if !defined(CORE_MOCK)
inline uint32_t getCycleCount() __attribute__((always_inline))
{
return esp_get_cycle_count();
}
#else
uint32_t getCycleCount();
#endif
};

#ifndef CORE_MOCK

uint32_t EspClass::getCycleCount()
{
return esp_get_cycle_count();
}

#endif // !defined(CORE_MOCK)
};

extern EspClass ESP;

Expand Down

0 comments on commit c74dcc9

Please sign in to comment.