[rtems commit] rtems: Add RTEMS_ALIGN_DOWN()
Sebastian Huber
sebh at rtems.org
Thu Sep 17 16:09:07 UTC 2020
Module: rtems
Branch: master
Commit: 641b31a48d48c59ef73c47a225f1012b11e0eea7
Changeset: http://git.rtems.org/rtems/commit/?id=641b31a48d48c59ef73c47a225f1012b11e0eea7
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Sep 16 10:33:52 2020 +0200
rtems: Add RTEMS_ALIGN_DOWN()
Update #3959.
Update #4074.
---
cpukit/include/rtems/score/basedefs.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/cpukit/include/rtems/score/basedefs.h b/cpukit/include/rtems/score/basedefs.h
index 5a7e4e4..4d16c88 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__)
More information about the vc
mailing list