]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
shred,sort: ensure faster unaligned access to rand module
authorPádraig Brady <P@draigBrady.com>
Fri, 25 Nov 2016 22:10:20 +0000 (22:10 +0000)
committerPádraig Brady <P@draigBrady.com>
Sun, 27 Nov 2016 00:27:45 +0000 (00:27 +0000)
glibc has changed the public define
from _STRING_ARCH_unaligned to _STRING_INLINE_unaligned as per
https://sourceware.org/bugzilla/show_bug.cgi?id=19462

* gl/lib/rand-isaac.c: Cater for both defines.
* gl/lib/randread.c: Likewise.
* src/system.h: Update commented out code.

gl/lib/rand-isaac.c
gl/lib/randread.c
src/system.h

index 5ad9cae012c7e99ae181d6b972a57db35364e1a0..349bf0e230655b3043329d097d4aeb52b1d402b3 100644 (file)
@@ -40,7 +40,7 @@
 /* If the platform supports unaligned access,
    then don't have -fsanitize=undefined warn about it.  */
 #undef ATTRIBUTE_NO_WARN_SANITIZE_UNDEFINED
-#if !_STRING_ARCH_unaligned \
+#if !(_STRING_ARCH_unaligned || _STRING_INLINE_unaligned) \
     || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9)
 # define ATTRIBUTE_NO_WARN_SANITIZE_UNDEFINED /* empty */
 #else
index ff85d56496c5a2582384bc183734b7d60a3446e8..2d211a084f47c699e5bf04e9c50d013ba0510082 100644 (file)
@@ -60,7 +60,7 @@
 # define MIN(a, b) ((a) < (b) ? (a) : (b))
 #endif
 
-#if _STRING_ARCH_unaligned
+#if _STRING_ARCH_unaligned || _STRING_INLINE_unaligned
 # define ALIGNED_POINTER(ptr, type) true
 #else
 # define ALIGNED_POINTER(ptr, type) ((size_t) (ptr) % alignof (type) == 0)
index e82dce498af70d4377116e6a6f962cf8570dcbfd..3fa0740c62e7d198b66f1cb174a27f23a1145d4a 100644 (file)
@@ -515,7 +515,7 @@ is_nul (void const *buf, size_t length)
    to avoid -fsanitize=undefined warnings.
    Considering coreutils is mainly concerned with relatively
    large buffers, we'll just use the defined behavior.  */
-#if 0 && _STRING_ARCH_unaligned
+#if 0 && (_STRING_ARCH_unaligned || _STRING_INLINE_unaligned)
   unsigned long word;
 #else
   unsigned char word;