[riot-notifications] [RIOT-OS/RIOT] cpu/cortexm_common: add inlined header only def for irq_% (#13999)

Marian Buschsieweke notifications at github.com
Mon May 11 10:31:05 CEST 2020


> Thas huge! In #13825 we were concerned about a 1% drop, and here we improve 22%!

I think we could even get another gain of at least 5% if we optimized for the common case. E.g. something link:

```C
static inline void mutex_lock(mutex_t *mutex)
{
    unsigned irqstate = irq_disable();
    /* Tell compiler to expect the if condition to be mostly true */
    if (__builtin_expect((mutex->queue.next == NULL), 1)) {
        /* Common case: Mutex is unlocked */
        mutex->queue.next = MUTEX_LOCKED;
        irq_restore(irqstate);
        return 1;
    }
    mutex_handle_uncommon_case(mutex);
}
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/13999#issuecomment-626555015
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200511/724f558d/attachment.htm>


More information about the notifications mailing list