From 990c134b82aae924bf6b7291aafdb28413f82da2 Mon Sep 17 00:00:00 2001
From: Terraneo Federico <fede.tft@miosix.org>
Date: Sun, 22 Mar 2026 12:12:19 +0100
Subject: [PATCH] libc: string: Fix warning in memrchr.c

---
 newlib/libc/string/local.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/string/local.h b/newlib/libc/string/local.h
index 8cb43f8e3..012a30d16 100644
--- a/newlib/libc/string/local.h
+++ b/newlib/libc/string/local.h
@@ -21,7 +21,7 @@ int __wcwidth (wint_t);
  * This macro is used to skip a few bytes to find an aligned pointer.
  * It's better to keep it as is even if _HAVE_HW_MISALIGNED_ACCESS is enabled,
  * to avoid small performance penalties (if they are not zero).  */
-#define UNALIGNED_X(X) ((long)X & (sizeof (long) - 1))
+#define UNALIGNED_X(X) ((long)(X) & (sizeof (long) - 1))
 
 #ifdef _HAVE_HW_MISALIGNED_ACCESS
 /* Hardware performs unaligned operations with little
-- 
2.47.3

