[newlib-cygwin/main] Make the UNALIGNED_X_Y() macro more robust against errors.

Jeff Johnston jjohnstn@sourceware.org
Mon Aug 10 18:49:03 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=81f45549e771fd4da7b88ad04bd9e6ec5c765d50

commit 81f45549e771fd4da7b88ad04bd9e6ec5c765d50
Author: Jan Dubiec <jdx@o2.pl>
Date:   Sun Aug 9 23:10:00 2026 +0200

    Make the UNALIGNED_X_Y() macro more robust against errors.
    
    Signed-off-by: Jan Dubiec <jdx@o2.pl>

Diff:
---
 newlib/libc/string/local.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/newlib/libc/string/local.h b/newlib/libc/string/local.h
index 94c7c4a8f..d9bff40ab 100644
--- a/newlib/libc/string/local.h
+++ b/newlib/libc/string/local.h
@@ -31,8 +31,8 @@ int __wcwidth (wint_t);
 #else /* _HAVE_HW_MISALIGNED_ACCESS */
 /* Nonzero if either X or Y is not aligned on a "long" boundary.  */
 #define UNALIGNED_X_Y(X, Y) \
-  (((long)(intptr_t)X & (sizeof (long) - 1)) | \
-   ((long)(intptr_t)Y & (sizeof (long) - 1)))
+  (((long)(intptr_t)(X) & (sizeof (long) - 1)) | \
+   ((long)(intptr_t)(Y) & (sizeof (long) - 1)))
 #endif /* _HAVE_HW_MISALIGNED_ACCESS */
 
 /* How many bytes are copied each iteration of the word copy loop.  */


More information about the Newlib-cvs mailing list