8000 std::bind is IRAM cache save, lambda is not. · dok-net/arduino-esp8266@dd9bd9f · GitHub
[go: up one dir, main page]

Skip to content

Commit dd9bd9f

Browse files
committed
std::bind is IRAM cache save, lambda is not.
1 parent 1770e8a commit dd9bd9f

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

cores/esp8266/Delegate.h

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,23 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3636
#include "circular_queue/ghostl.h"
3737
#endif
3838

39+
namespace
40+
{
41+
42+
template<typename R, typename... P>
43+
R IRAM_ATTR vPtrToFunPtrExec(void* fn, P... args)
44+
{
45+
using target_type = R(P...);
46+
return reinterpret_cast<target_type*>(fn)(std::forward<P...>(args...));
47+
}
48+
49+
}
50+
3951
namespace delegate
4052
{
4153
namespace detail
4254
{
4355

44-
template<typename R, typename... P>
45-
R IRAM_ATTR vPtrToFunPtrExec(void* fn, P... args)
46-
{
47-
using target_type = R(P...);
48-
return reinterpret_cast<target_type*>(fn)(std::forward<P...>(args...));
49-
}
50-
5156
#if !defined(ARDUINO) || defined(ESP8266) || defined(ESP32)
5257
template<typename A, typename R, typename... P>
5358
class DelegatePImpl {

0 commit comments

Comments
 (0)
0