diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-09-16 10:33:52 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-09-17 17:42:25 +0200 |
commit | 641b31a48d48c59ef73c47a225f1012b11e0eea7 (patch) | |
tree | 9423231fd71f7fee1fb58d90e05d7b0a7a35cb11 | |
parent | build: Allow test program item UIDs with a "-" (diff) | |
download | rtems-641b31a48d48c59ef73c47a225f1012b11e0eea7.tar.bz2 |
rtems: Add RTEMS_ALIGN_DOWN()
Update #3959.
Update #4074.
-rw-r--r-- | cpukit/include/rtems/score/basedefs.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cpukit/include/rtems/score/basedefs.h b/cpukit/include/rtems/score/basedefs.h index 5a7e4e4f31..4d16c88b49 100644 --- a/cpukit/include/rtems/score/basedefs.h +++ b/cpukit/include/rtems/score/basedefs.h @@ -220,6 +220,21 @@ #endif /** + * @brief Returns the specified value aligned down to the specified alignment. + * + * @param _value is the value to align down. + * + * @param _alignment is the desired alignment in bytes. The alignment shall be + * a power of two, otherwise the returned value is undefined. The alignment + * parameter is evaluated twice. + * + * @return The specified value aligned down to the specified alignment is + * returned. + */ +#define RTEMS_ALIGN_DOWN( _value, _alignment ) \ + ( ( _value ) & ~( ( _alignment ) - 1 ) ) + +/** * @brief Instructs the compiler to enforce the specified alignment. */ #if defined(__GNUC__) |