Skip to content

Commit c74dcc9

Browse files
committed
Force gcc inlining, use same style for getCycleCount as for getCpuFreqMHz.
1 parent 400632f commit c74dcc9

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

cores/esp8266/Esp.h

+7-13
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class EspClass {
124124
#if defined(F_CPU) || defined(CORE_MOCK)
125125
constexpr
126126
#endif
127-
uint8_t getCpuFreqMHz() const
127+
inline uint8_t getCpuFreqMHz() const __attribute__((always_inline))
128128
{
129129
return esp_get_cpu_freq_mhz();
130130
}
@@ -166,21 +166,15 @@ class EspClass {
166166
uint8_t *random(uint8_t *resultArray, const size_t outputSizeBytes) const;
167167
uint32_t random() const;
168168

169-
#ifndef CORE_MOCK
170-
inline uint32_t getCycleCount() __attribute__((always_inline));
169+
#if !defined(CORE_MOCK)
170+
inline uint32_t getCycleCount() __attribute__((always_inline))
171+
{
172+
return esp_get_cycle_count();
173+
}
171174
#else
172175
uint32_t getCycleCount();
173-
#endif
174-
};
175-
176-
#ifndef CORE_MOCK
177-
178-
uint32_t EspClass::getCycleCount()
179-
{
180-
return esp_get_cycle_count();
181-
}
182-
183176
#endif // !defined(CORE_MOCK)
177+
};
184178

185179
extern EspClass ESP;
186180

0 commit comments

Comments
 (0)