pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/devel/zzuf Prefer compiler endian macros if they exist.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/36930f3acdd2
branches:  trunk
changeset: 378128:36930f3acdd2
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Sun Apr 01 20:27:20 2018 +0000

description:
Prefer compiler endian macros if they exist.

diffstat:

 devel/zzuf/distinfo                     |   3 ++-
 devel/zzuf/patches/patch-src_util_md5.c |  32 ++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletions(-)

diffs (51 lines):

diff -r 7ab270db760f -r 36930f3acdd2 devel/zzuf/distinfo
--- a/devel/zzuf/distinfo       Sun Apr 01 20:26:25 2018 +0000
+++ b/devel/zzuf/distinfo       Sun Apr 01 20:27:20 2018 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.4 2017/04/16 21:46:12 khorben Exp $
+$NetBSD: distinfo,v 1.5 2018/04/01 20:27:20 joerg Exp $
 
 SHA1 (zzuf-0.15.tar.gz) = 21541d54cec64750c2dd3366a73832e6f5250833
 RMD160 (zzuf-0.15.tar.gz) = 12052a511a789d18ee3af3428f6e69e3492452a0
@@ -7,4 +7,5 @@
 SHA1 (patch-config.h.in) = 517bc764b4b53b15e189fe39322341fe50af3ec8
 SHA1 (patch-configure) = e6797a1b4f90ebb41ea86e7d99241ca78b9b0ad9
 SHA1 (patch-configure.ac) = d236876a47c3df13b6a82dda5c941f7a314b1abc
+SHA1 (patch-src_util_md5.c) = 12c0068355fb8c3a63f329e5774aa0cebcad7b44
 SHA1 (patch-src_zzuf.c) = 28a1223a7a4d4a3d6a0320910b7c782ce202c8d0
diff -r 7ab270db760f -r 36930f3acdd2 devel/zzuf/patches/patch-src_util_md5.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/zzuf/patches/patch-src_util_md5.c   Sun Apr 01 20:27:20 2018 +0000
@@ -0,0 +1,32 @@
+$NetBSD: patch-src_util_md5.c,v 1.1 2018/04/01 20:27:21 joerg Exp $
+
+--- src/util/md5.c.orig        2018-03-31 17:41:34.690815147 +0000
++++ src/util/md5.c
+@@ -121,8 +121,18 @@ void zzuf_destroy_md5(uint8_t *digest, z
+ static void swapwords(uint32_t *buf, unsigned words)
+ {
+     /* XXX: no need to swap words on little endian machines */
++#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ - __ORDER_LITTLE_ENDIAN__ + 0 == 0)
++    return;
++#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ - __ORDER_BIG_ENDIAN__ + 0 == 0)
++    while (words > 0)
++    {
++        uint8_t *b = (uint8_t *)buf;
++        *buf++ = (uint32_t)b[3] << 24 | b[2] << 16 | b[1] << 8 | b[0];
++        words--;
++    }
++#else
+ #if defined HAVE_ENDIAN_H
+-    if (__BYTE_ORDER == __LITTLE_ENDIAN)
++    if (_BYTE_ORDER == _LITTLE_ENDIAN)
+         return;
+ #else
+     /* This is compile-time optimised with at least -O1 or -Os */
+@@ -137,6 +147,7 @@ static void swapwords(uint32_t *buf, uns
+         *buf++ = (uint32_t)b[3] << 24 | b[2] << 16 | b[1] << 8 | b[0];
+         words--;
+     }
++#endif
+ }
+ 
+ /* #define F1(x, y, z) (x & y | ~x & z) */



Home | Main Index | Thread Index | Old Index