summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-09-16 10:34:12 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-09-17 17:42:25 +0200
commitdce1cdf19e6d8d7c5f72163401171648093d27bb (patch)
tree250b04f5134b91b1e260bbe0bc72c55a004e6a68 /cpukit
parentrtems: Add RTEMS_ALIGN_DOWN() (diff)
downloadrtems-dce1cdf19e6d8d7c5f72163401171648093d27bb.tar.bz2
rtems: Add RTEMS_ALIGN_UP()
Update #3959. Update #4074.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/include/rtems/score/basedefs.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/cpukit/include/rtems/score/basedefs.h b/cpukit/include/rtems/score/basedefs.h
index 4d16c88b49..c31b4ebef7 100644
--- a/cpukit/include/rtems/score/basedefs.h
+++ b/cpukit/include/rtems/score/basedefs.h
@@ -235,6 +235,21 @@
( ( _value ) & ~( ( _alignment ) - 1 ) )
/**
+ * @brief Returns the specified value aligned up to the specified alignment.
+ *
+ * @param _value is the value to align up.
+ *
+ * @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 up to the specified alignment is
+ * returned.
+ */
+#define RTEMS_ALIGN_UP( _value, _alignment ) \
+ ( ( ( _value ) + ( _alignment ) - 1 ) & ~( ( _alignment ) - 1 ) )
+
+/**
* @brief Instructs the compiler to enforce the specified alignment.
*/
#if defined(__GNUC__)