1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/tests/unittests/tests-kernel_defines
Marian Buschsieweke 68424a924c
core: Add IS_CT_CONSTANT()
This adds a simple macro to check (at C level) whether a given
expression is proven to be compile time constant and suitable for
constant folding. This allows writing code like this:

```C
int gpio_read(gpio_t pin) {
    if (IS_CT_CONSTANT(pin)) {
        /* this implementation should even be able to use the port and
         * pin number as immediate in inline assembly */
    }
    else {
        /* less efficient implementation that cannot use port and pin
         * number as immediate in inline assembly */
    }
}
```
2022-01-06 23:30:56 +01:00
..
Makefile tests/unittests: add test for kernel_defines 2021-09-21 17:43:29 +02:00
tests-kernel_defines.c core: Add IS_CT_CONSTANT() 2022-01-06 23:30:56 +01:00
tests-kernel_defines.h tests/unittests: add test for kernel_defines 2021-09-21 17:43:29 +02:00