This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 5d80cf7b83d arch/tricore: remove magic number in tricore_checkstack.c
5d80cf7b83d is described below

commit 5d80cf7b83d9da45b4f5d0b27bb5841644f28ceb
Author: wangchengdong <wangchengd...@lixiang.com>
AuthorDate: Tue Sep 16 16:42:13 2025 +0800

    arch/tricore: remove magic number in tricore_checkstack.c
    
      before:
      |   start = (alloc + 3) & ~3;
      |   end   = (alloc + size) & ~3;
      after:
      |   start = STACK_ALIGN_UP((uintptr_t)alloc);
      |   end   = STACK_ALIGN_DOWN((uintptr_t)alloc + size);
    
    Signed-off-by: Chengdong Wang <wangchengd...@lixiang.com>
---
 arch/tricore/src/common/tricore_checkstack.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/tricore/src/common/tricore_checkstack.c 
b/arch/tricore/src/common/tricore_checkstack.c
index 0d17694c271..c4f7d3fccf0 100644
--- a/arch/tricore/src/common/tricore_checkstack.c
+++ b/arch/tricore/src/common/tricore_checkstack.c
@@ -79,8 +79,8 @@ size_t tricore_stack_check(uintptr_t alloc, size_t size)
 
   /* Get aligned addresses of the top and bottom of the stack */
 
-  start = (alloc + 3) & ~3;
-  end   = (alloc + size) & ~3;
+  start = STACK_ALIGN_UP((uintptr_t)alloc);
+  end   = STACK_ALIGN_DOWN((uintptr_t)alloc + size);
 
   /* Get the adjusted size based on the top and bottom of the stack */
 

Reply via email to