1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00
Commit Graph

4 Commits

Author SHA1 Message Date
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
Marian Buschsieweke
f2a53c8fb3
tets/unittests: add test for DECLARE_CONSTANT() 2021-11-10 15:22:48 +01:00
Benjamin Valentin
a803cab439 tests/unittests: add test for index_of() 2021-11-05 16:42:38 +01:00
Benjamin Valentin
eaf5162b5d tests/unittests: add test for kernel_defines 2021-09-21 17:43:29 +02:00