[rtems commit] score: Use RTEMS_ALIGN_UP()

Sebastian Huber sebh at rtems.org
Mon Sep 28 05:17:52 UTC 2020


Module:    rtems
Branch:    master
Commit:    3c0255766d591e2ae5718003416456af91debd55
Changeset: http://git.rtems.org/rtems/commit/?id=3c0255766d591e2ae5718003416456af91debd55

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Sep 21 08:10:06 2020 +0200

score: Use RTEMS_ALIGN_UP()

Update #4007.

---

 cpukit/score/src/coremsg.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/cpukit/score/src/coremsg.c b/cpukit/score/src/coremsg.c
index fc6f9eb..af8dbd6 100644
--- a/cpukit/score/src/coremsg.c
+++ b/cpukit/score/src/coremsg.c
@@ -51,7 +51,6 @@ bool _CORE_message_queue_Initialize(
 {
   size_t message_buffering_required = 0;
   size_t aligned_message_size;
-  size_t align_mask;
 
   the_message_queue->maximum_pending_messages   = maximum_pending_messages;
   the_message_queue->number_of_pending_messages = 0;
@@ -62,8 +61,10 @@ bool _CORE_message_queue_Initialize(
    * Align up the maximum message size to be an integral multiple of the
    * pointer size.
    */
-  align_mask = sizeof(uintptr_t) - 1;
-  aligned_message_size = ( maximum_message_size + align_mask ) & ~align_mask;
+  aligned_message_size = RTEMS_ALIGN_UP(
+    maximum_message_size,
+    sizeof( uintptr_t )
+  );
 
   /*
    * Check for an integer overflow.  It can occur while aligning up the maximum



More information about the vc mailing list