pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/lang/perl5
Module Name: pkgsrc
Committed By: maya
Date: Thu Oct 10 17:59:57 UTC 2019
Modified Files:
pkgsrc/lang/perl5: Makefile distinfo hacks.mk
Added Files:
pkgsrc/lang/perl5/patches: patch-alignment_1 patch-alignment_2
Log Message:
perl5: backport upstream commits to remove a codepath that assumes
unaligned accesses are OK.
Remove relevant hacks.mk entry to disable optimizations.
PR pkg/53568
To generate a diff of this commit:
cvs rdiff -u -r1.255 -r1.256 pkgsrc/lang/perl5/Makefile
cvs rdiff -u -r1.158 -r1.159 pkgsrc/lang/perl5/distinfo
cvs rdiff -u -r1.23 -r1.24 pkgsrc/lang/perl5/hacks.mk
cvs rdiff -u -r0 -r1.1 pkgsrc/lang/perl5/patches/patch-alignment_1 \
pkgsrc/lang/perl5/patches/patch-alignment_2
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/lang/perl5/Makefile
diff -u pkgsrc/lang/perl5/Makefile:1.255 pkgsrc/lang/perl5/Makefile:1.256
--- pkgsrc/lang/perl5/Makefile:1.255 Sun Aug 11 10:14:17 2019
+++ pkgsrc/lang/perl5/Makefile Thu Oct 10 17:59:57 2019
@@ -1,8 +1,10 @@
-# $NetBSD: Makefile,v 1.255 2019/08/11 10:14:17 adam Exp $
+# $NetBSD: Makefile,v 1.256 2019/10/10 17:59:57 maya Exp $
.include "license.mk"
.include "Makefile.common"
+PKGREVISION= 1
+
COMMENT= Practical Extraction and Report Language
CONFLICTS+= perl-base-[0-9]* perl-thread-[0-9]*
Index: pkgsrc/lang/perl5/distinfo
diff -u pkgsrc/lang/perl5/distinfo:1.158 pkgsrc/lang/perl5/distinfo:1.159
--- pkgsrc/lang/perl5/distinfo:1.158 Sun Aug 11 10:14:17 2019
+++ pkgsrc/lang/perl5/distinfo Thu Oct 10 17:59:57 2019
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.158 2019/08/11 10:14:17 adam Exp $
+$NetBSD: distinfo,v 1.159 2019/10/10 17:59:57 maya Exp $
SHA1 (perl-5.30.0.tar.xz) = cc8d1e08ffe4624c197a44d02855632725d39f8e
RMD160 (perl-5.30.0.tar.xz) = 64ff4c65823122c337e18278585d71def1de9c5d
@@ -6,6 +6,8 @@ SHA512 (perl-5.30.0.tar.xz) = 68a295eccd
Size (perl-5.30.0.tar.xz) = 12419868 bytes
SHA1 (patch-Configure) = 6000aafeb993fd096c9b1327302b510aa0d386bb
SHA1 (patch-Makefile.SH) = 93cae9736ef94cdd9e5748f7e0a0183332c2f3b3
+SHA1 (patch-alignment_1) = b68c0916b271523922caa7f89edb165284e7b5f4
+SHA1 (patch-alignment_2) = cae8495c4a092e31da422bf5684481091ee2adf3
SHA1 (patch-caretx.c) = b76b4175a58123fa4dfd2adf36b2207dcb6cf65a
SHA1 (patch-cflags.SH) = 7ad64e5a17b876bff4bbe238abc4a57354acf4fe
SHA1 (patch-cpan_ExtUtils-MakeMaker_lib_ExtUtils_MM__Unix.pm) = 3a2b39c9eb903e68ef7d03ae448c51c147c19aa1
Index: pkgsrc/lang/perl5/hacks.mk
diff -u pkgsrc/lang/perl5/hacks.mk:1.23 pkgsrc/lang/perl5/hacks.mk:1.24
--- pkgsrc/lang/perl5/hacks.mk:1.23 Tue Apr 23 09:27:46 2019
+++ pkgsrc/lang/perl5/hacks.mk Thu Oct 10 17:59:57 2019
@@ -1,4 +1,4 @@
-# $NetBSD: hacks.mk,v 1.23 2019/04/23 09:27:46 adam Exp $
+# $NetBSD: hacks.mk,v 1.24 2019/10/10 17:59:57 maya Exp $
.if !defined(PERL5_HACKS_MK)
PERL5_HACKS_MK= defined
@@ -22,16 +22,6 @@ PKG_HACKS+= m68k-codegen
BUILDLINK_TRANSFORM+= opt:-O[0-9]*:-Os
.endif
-### [ Wed Nov 21 11:35:48 IST 2018 : maya ]
-### Alignment fault on perl 5.28.0
-### Might be specific to GCC 4.9
-### https://rt.perl.org/Public/Bug/Display.html?id=133495
-### See PR pkg/53568
-.if ${OPSYS} == "SunOS" && !empty(MACHINE_ARCH:Msparc*)
-PKG_HACKS+= sun-sparc-alignment-fault
-BUILDLINK_TRANSFORM+= opt:-O3:-O2
-.endif
-
### [Fri Jan 31 11:09:04 CST 2014 : schnoebe]
### [Fri Oct 28 11:53:57 EDT 2016 : dholland - extended to gcc5]
### gcc-[45].*.* in NetBSD/alpha causes unaligned access exception in perl.
Added files:
Index: pkgsrc/lang/perl5/patches/patch-alignment_1
diff -u /dev/null pkgsrc/lang/perl5/patches/patch-alignment_1:1.1
--- /dev/null Thu Oct 10 17:59:57 2019
+++ pkgsrc/lang/perl5/patches/patch-alignment_1 Thu Oct 10 17:59:57 2019
@@ -0,0 +1,273 @@
+$NetBSD: patch-alignment_1,v 1.1 2019/10/10 17:59:57 maya Exp $
+
+Apply upstream commit (not needed in perl >= 5.32.x)
+
+From ee9ac1cd8eb988fea70841eae211b11355711416 Mon Sep 17 00:00:00 2001
+From: Matt Turner <mattst88%gmail.com@localhost>
+Date: Wed, 4 Sep 2019 21:04:47 -0700
+Subject: [PATCH] Digest-MD5: Consolidate byte-swapping paths
+
+The code guarded by #ifndef U32_ALIGNMENT_REQUIRED attempts to optimize
+byte-swapping by doing unaligned loads, but accessing data through
+unaligned pointers is undefined behavior in C. Moreover, compilers are
+more than capable of recognizing these open-coded byte-swap patterns and
+emitting a bswap instruction, or an unaligned load instruction, or a
+combined load, etc. There's no need for multiple paths to attain the
+desired result.
+
+See https://rt.perl.org/Ticket/Display.html?id=133495
+---
+ cpan/Digest-MD5/MD5.xs | 44 +----------------
+ cpan/Digest-MD5/Makefile.PL | 114 --------------------------------------------
+ cpan/Digest-MD5/t/files.t | 2 +-
+ 3 files changed, 3 insertions(+), 157 deletions(-)
+
+diff --git a/cpan/Digest-MD5/MD5.xs b/cpan/Digest-MD5/MD5.xs
+index a48d951056..964d37fb0e 100644
+--- cpan/Digest-MD5/MD5.xs.orig
++++ cpan/Digest-MD5/MD5.xs
+@@ -106,20 +106,6 @@ static MAGIC *THX_sv_magicext(pTHX_ SV *sv, SV *obj, int type,
+ * values. The following macros (and functions) allow us to convert
+ * between native integers and such values.
+ */
+-#undef BYTESWAP
+-#ifndef U32_ALIGNMENT_REQUIRED
+- #if BYTEORDER == 0x1234 /* 32-bit little endian */
+- #define BYTESWAP(x) (x) /* no-op */
+-
+- #elif BYTEORDER == 0x4321 /* 32-bit big endian */
+- #define BYTESWAP(x) ((((x)&0xFF)<<24) \
+- |(((x)>>24)&0xFF) \
+- |(((x)&0x0000FF00)<<8) \
+- |(((x)&0x00FF0000)>>8) )
+- #endif
+-#endif
+-
+-#ifndef BYTESWAP
+ static void u2s(U32 u, U8* s)
+ {
+ *s++ = (U8)(u & 0xFF);
+@@ -132,7 +118,6 @@ static void u2s(U32 u, U8* s)
+ ((U32)(*(s+1)) << 8) | \
+ ((U32)(*(s+2)) << 16) | \
+ ((U32)(*(s+3)) << 24))
+-#endif
+
+ /* This structure keeps the current state of algorithm.
+ */
+@@ -279,29 +264,16 @@ MD5Transform(MD5_CTX* ctx, const U8* buf, STRLEN blocks)
+ U32 C = ctx->C;
+ U32 D = ctx->D;
+
+-#ifndef U32_ALIGNMENT_REQUIRED
+- const U32 *x = (U32*)buf; /* really just type casting */
+-#endif
+-
+ do {
+ U32 a = A;
+ U32 b = B;
+ U32 c = C;
+ U32 d = D;
+
+-#if BYTEORDER == 0x1234 && !defined(U32_ALIGNMENT_REQUIRED)
+- const U32 *X = x;
+- #define NEXTx (*x++)
+-#else
+- U32 X[16]; /* converted values, used in round 2-4 */
++ U32 X[16]; /* little-endian values, used in round 2-4 */
+ U32 *uptr = X;
+ U32 tmp;
+- #ifdef BYTESWAP
+- #define NEXTx (tmp=*x++, *uptr++ = BYTESWAP(tmp))
+- #else
+ #define NEXTx (s2u(buf,tmp), buf += 4, *uptr++ = tmp)
+- #endif
+-#endif
+
+ #ifdef MD5_DEBUG
+ if (buf == ctx->buffer)
+@@ -313,7 +285,7 @@ MD5Transform(MD5_CTX* ctx, const U8* buf, STRLEN blocks)
+ int i;
+ fprintf(stderr,"[");
+ for (i = 0; i < 16; i++) {
+- fprintf(stderr,"%x,", x[i]);
++ fprintf(stderr,"%x,", x[i]); /* FIXME */
+ }
+ fprintf(stderr,"]\n");
+ }
+@@ -468,30 +440,18 @@ MD5Final(U8* digest, MD5_CTX *ctx)
+
+ bits_low = ctx->bytes_low << 3;
+ bits_high = (ctx->bytes_high << 3) | (ctx->bytes_low >> 29);
+-#ifdef BYTESWAP
+- *(U32*)(ctx->buffer + fill) = BYTESWAP(bits_low); fill += 4;
+- *(U32*)(ctx->buffer + fill) = BYTESWAP(bits_high); fill += 4;
+-#else
+ u2s(bits_low, ctx->buffer + fill); fill += 4;
+ u2s(bits_high, ctx->buffer + fill); fill += 4;
+-#endif
+
+ MD5Transform(ctx, ctx->buffer, fill >> 6);
+ #ifdef MD5_DEBUG
+ fprintf(stderr," Result: %s\n", ctx_dump(ctx));
+ #endif
+
+-#ifdef BYTESWAP
+- *(U32*)digest = BYTESWAP(ctx->A); digest += 4;
+- *(U32*)digest = BYTESWAP(ctx->B); digest += 4;
+- *(U32*)digest = BYTESWAP(ctx->C); digest += 4;
+- *(U32*)digest = BYTESWAP(ctx->D);
+-#else
+ u2s(ctx->A, digest);
+ u2s(ctx->B, digest+4);
+ u2s(ctx->C, digest+8);
+ u2s(ctx->D, digest+12);
+-#endif
+ }
+
+ #ifndef INT2PTR
+diff --git a/cpan/Digest-MD5/Makefile.PL b/cpan/Digest-MD5/Makefile.PL
+index 1015058bac..76906d1046 100644
+--- cpan/Digest-MD5/Makefile.PL.orig
++++ cpan/Digest-MD5/Makefile.PL
+@@ -5,7 +5,6 @@ use Config qw(%Config);
+ use ExtUtils::MakeMaker;
+
+ my @extra;
+-push(@extra, DEFINE => "-DU32_ALIGNMENT_REQUIRED") unless free_u32_alignment();
+ push(@extra, INSTALLDIRS => 'perl') if $] >= 5.008 && $] < 5.012;
+
+ if ($^O eq 'VMS') {
+@@ -39,119 +38,6 @@ WriteMakefile(
+
+
+
+-sub free_u32_alignment
+-{
+- $|=1;
+- if (exists $Config{d_u32align}) {
+- print "Perl's config says that U32 access must ";
+- print "not " unless $Config{d_u32align};
+- print "be aligned.\n";
+- return !$Config{d_u32align};
+- }
+-
+- if ($^O eq 'VMS' || $^O eq 'MSWin32') {
+- print "Assumes that $^O implies free alignment for U32 access.\n";
+- return 1;
+- }
+-
+- if ($^O eq 'hpux' && $Config{osvers} < 11.0) {
+- print "Will not test for free alignment on older HP-UX.\n";
+- return 0;
+- }
+-
+- print "Testing alignment requirements for U32... ";
+- open(ALIGN_TEST, ">u32align.c") or die "$!";
+- print ALIGN_TEST <<'EOT'; close(ALIGN_TEST);
+-/*--------------------------------------------------------------*/
+-/* This program allocates a buffer of U8 (char) and then tries */
+-/* to access it through a U32 pointer at every offset. The */
+-/* program is expected to die with a bus error/seg fault for */
+-/* machines that do not support unaligned integer read/write */
+-/*--------------------------------------------------------------*/
+-
+-#include <stdio.h>
+-#include "EXTERN.h"
+-#include "perl.h"
+-
+-#ifdef printf
+- #undef printf
+-#endif
+-
+-int main(int argc, char** argv, char** env)
+-{
+-#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
+- volatile U8 buf[] = "\0\0\0\1\0\0\0\0";
+- volatile U32 *up;
+- int i;
+-
+- if (sizeof(U32) != 4) {
+- printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
+- exit(1);
+- }
+-
+- fflush(stdout);
+-
+- for (i = 0; i < 4; i++) {
+- up = (U32*)(buf + i);
+- if (! ((*up == 1 << (8*i)) || /* big-endian */
+- (*up == 1 << (8*(3-i))) /* little-endian */
+- )
+- )
+- {
+- printf("read failed (%x)\n", *up);
+- exit(2);
+- }
+- }
+-
+- /* write test */
+- for (i = 0; i < 4; i++) {
+- up = (U32*)(buf + i);
+- *up = 0xBeef;
+- if (*up != 0xBeef) {
+- printf("write failed (%x)\n", *up);
+- exit(3);
+- }
+- }
+-
+- printf("no restrictions\n");
+- exit(0);
+-#else
+- printf("unusual byteorder, playing safe\n");
+- exit(1);
+-#endif
+- return 0;
+-}
+-/*--------------------------------------------------------------*/
+-EOT
+-
+- my $cc_cmd = "$Config{cc} $Config{ccflags} -I$Config{archlibexp}/CORE";
+- my $exe = "u32align$Config{exe_ext}";
+- $cc_cmd .= " -o $exe";
+- my $rc;
+- $rc = system("$cc_cmd $Config{ldflags} u32align.c $Config{libs}");
+- if ($rc) {
+- print "Can't compile test program. Will ensure alignment to play safe.\n\n";
+- unlink("u32align.c", $exe, "u32align$Config{obj_ext}");
+- return 0;
+- }
+-
+- $rc = system("./$exe");
+- unlink("u32align.c", $exe, "u32align$Config{obj_ext}");
+-
+- return 1 unless $rc;
+-
+- if ($rc > 0x80) {
+- (my $cp = $rc) >>= 8;
+- print "Test program exit status was $cp\n";
+- }
+- if ($rc & 0x80) {
+- $rc &= ~0x80;
+- unlink("core") && print "Core dump deleted\n";
+- }
+- print "signal $rc\n" if $rc && $rc < 0x80;
+- return 0;
+-}
+-
+ BEGIN {
+ # compatibility with older versions of MakeMaker
+ my $developer = -d ".git";
+diff --git a/cpan/Digest-MD5/t/files.t b/cpan/Digest-MD5/t/files.t
+index 63479c24a3..ef64088c8c 100644
+--- cpan/Digest-MD5/t/files.t.orig
++++ cpan/Digest-MD5/t/files.t
+@@ -21,7 +21,7 @@ EOT
+ # This is the output of: 'md5sum README MD5.xs rfc1321.txt'
+ $EXPECT = <<EOT;
+ 2f93400875dbb56f36691d5f69f3eba5 README
+-9572832f3628e3bebcdd54f47c43dc5a MD5.xs
++5b8b4f96bc27a425501307c5461970db MD5.xs
+ 754b9db19f79dbc4992f7166eb0f37ce rfc1321.txt
+ EOT
+ }
Index: pkgsrc/lang/perl5/patches/patch-alignment_2
diff -u /dev/null pkgsrc/lang/perl5/patches/patch-alignment_2:1.1
--- /dev/null Thu Oct 10 17:59:57 2019
+++ pkgsrc/lang/perl5/patches/patch-alignment_2 Thu Oct 10 17:59:57 2019
@@ -0,0 +1,187 @@
+$NetBSD: patch-alignment_2,v 1.1 2019/10/10 17:59:57 maya Exp $
+
+Apply upstream commit (not needed in perl >= 5.32.x)
+
+From e8864dba80952684bf3afe83438d4eee0c3939a9 Mon Sep 17 00:00:00 2001
+From: Matt Turner <mattst88%gmail.com@localhost>
+Date: Wed, 4 Sep 2019 21:48:56 -0700
+Subject: [PATCH 1/1] Clean up U8TO*_LE macro implementations
+
+The code guarded by #ifndef U32_ALIGNMENT_REQUIRED attempts to optimize
+byte-swapping by doing unaligned loads, but accessing data through
+unaligned pointers is undefined behavior in C. Moreover, compilers are
+more than capable of recognizing these open-coded byte-swap patterns and
+emitting a bswap instruction, or an unaligned load instruction, or a
+combined load, etc. There's no need for multiple paths to attain the
+desired result.
+
+See https://rt.perl.org/Ticket/Display.html?id=133495
+---
+ hv_macro.h | 31 ++++++++++++-------------------
+ stadtx_hash.h | 52 ----------------------------------------------------
+ zaphod32_hash.h | 35 -----------------------------------
+ 3 files changed, 12 insertions(+), 106 deletions(-)
+
+diff --git a/hv_macro.h b/hv_macro.h
+index 77a4c84896..02c0baad08 100644
+--- hv_macro.h.orig
++++ hv_macro.h
+@@ -6,7 +6,7 @@
+ #endif
+
+ /*-----------------------------------------------------------------------------
+- * Endianess, misalignment capabilities and util macros
++ * Endianess and util macros
+ *
+ * The following 3 macros are defined in this section. The other macros defined
+ * are only needed to help derive these 3.
+@@ -20,29 +20,22 @@
+ * ROTR64(x,r) Rotate x right by r bits
+ */
+
+-#ifndef U32_ALIGNMENT_REQUIRED
++#ifndef U8TO16_LE
+ #if (BYTEORDER == 0x1234 || BYTEORDER == 0x12345678)
+- #define U8TO16_LE(ptr) (*((const U16*)(ptr)))
+- #define U8TO32_LE(ptr) (*((const U32*)(ptr)))
+- #define U8TO64_LE(ptr) (*((const U64*)(ptr)))
++ #define U8TO16_LE(ptr) ((U32)(ptr)[1]|(U32)(ptr)[0]<<8)
++ #define U8TO32_LE(ptr) ((U32)(ptr)[3]|(U32)(ptr)[2]<<8|(U32)(ptr)[1]<<16|(U32)(ptr)[0]<<24)
++ #define U8TO64_LE(ptr) ((U64)(ptr)[7]|(U64)(ptr)[6]<<8|(U64)(ptr)[5]<<16|(U64)(ptr)[4]<<24|\
++ (U64)(ptr)[3]<<32|(U64)(ptr)[4]<<40|\
++ (U64)(ptr)[1]<<48|(U64)(ptr)[0]<<56)
+ #elif (BYTEORDER == 0x4321 || BYTEORDER == 0x87654321)
+- #if defined(__GNUC__) && (__GNUC__>4 || (__GNUC__==4 && __GNUC_MINOR__>=3))
+- #define U8TO16_LE(ptr) (__builtin_bswap16(*((U16*)(ptr))))
+- #define U8TO32_LE(ptr) (__builtin_bswap32(*((U32*)(ptr))))
+- #define U8TO64_LE(ptr) (__builtin_bswap64(*((U64*)(ptr))))
+- #endif
++ #define U8TO16_LE(ptr) ((U32)(ptr)[0]|(U32)(ptr)[1]<<8)
++ #define U8TO32_LE(ptr) ((U32)(ptr)[0]|(U32)(ptr)[1]<<8|(U32)(ptr)[2]<<16|(U32)(ptr)[3]<<24)
++ #define U8TO64_LE(ptr) ((U64)(ptr)[0]|(U64)(ptr)[1]<<8|(U64)(ptr)[2]<<16|(U64)(ptr)[3]<<24|\
++ (U64)(ptr)[4]<<32|(U64)(ptr)[5]<<40|\
++ (U64)(ptr)[6]<<48|(U64)(ptr)[7]<<56)
+ #endif
+ #endif
+
+-#ifndef U8TO16_LE
+- /* Without a known fast bswap32 we're just as well off doing this */
+- #define U8TO16_LE(ptr) ((U32)(ptr)[0]|(U32)(ptr)[1]<<8)
+- #define U8TO32_LE(ptr) ((U32)(ptr)[0]|(U32)(ptr)[1]<<8|(U32)(ptr)[2]<<16|(U32)(ptr)[3]<<24)
+- #define U8TO64_LE(ptr) ((U64)(ptr)[0]|(U64)(ptr)[1]<<8|(U64)(ptr)[2]<<16|(U64)(ptr)[3]<<24|\
+- (U64)(ptr)[4]<<32|(U64)(ptr)[5]<<40|\
+- (U64)(ptr)[6]<<48|(U64)(ptr)[7]<<56)
+-#endif
+-
+ #ifdef CAN64BITHASH
+ #ifndef U64TYPE
+ /* This probably isn't going to work, but failing with a compiler error due to
+diff --git a/stadtx_hash.h b/stadtx_hash.h
+index bd09c2f938..5ee879485d 100644
+--- stadtx_hash.h.orig
++++ stadtx_hash.h
+@@ -43,58 +43,6 @@
+ #define STMT_END while(0)
+ #endif
+
+-#ifndef STADTX_ALLOW_UNALIGNED_AND_LITTLE_ENDIAN
+-/* STADTX_ALLOW_UNALIGNED_AND_LITTLE_ENDIAN only matters if nothing has defined U8TO64_LE etc,
+- * and when built with Perl these should be defined before this file is loaded.
+- */
+-#ifdef U32_ALIGNMENT_REQUIRED
+-#define STADTX_ALLOW_UNALIGNED_AND_LITTLE_ENDIAN 0
+-#else
+-#define STADTX_ALLOW_UNALIGNED_AND_LITTLE_ENDIAN 1
+-#endif
+-#endif
+-
+-#ifndef U8TO64_LE
+-#if STADTX_ALLOW_UNALIGNED_AND_LITTLE_ENDIAN
+-#define U8TO64_LE(ptr) (*((const U64 *)(ptr)))
+-#else
+-#define U8TO64_LE(ptr) (\
+- (U64)(ptr)[7] << 56 | \
+- (U64)(ptr)[6] << 48 | \
+- (U64)(ptr)[5] << 40 | \
+- (U64)(ptr)[4] << 32 | \
+- (U64)(ptr)[3] << 24 | \
+- (U64)(ptr)[2] << 16 | \
+- (U64)(ptr)[1] << 8 | \
+- (U64)(ptr)[0] \
+-)
+-#endif
+-#endif
+-
+-#ifndef U8TO32_LE
+-#if STADTX_ALLOW_UNALIGNED_AND_LITTLE_ENDIAN
+-#define U8TO32_LE(ptr) (*((const U32 *)(ptr)))
+-#else
+-#define U8TO32_LE(ptr) (\
+- (U32)(ptr)[3] << 24 | \
+- (U32)(ptr)[2] << 16 | \
+- (U32)(ptr)[1] << 8 | \
+- (U32)(ptr)[0] \
+-)
+-#endif
+-#endif
+-
+-#ifndef U8TO16_LE
+-#if STADTX_ALLOW_UNALIGNED_AND_LITTLE_ENDIAN
+-#define U8TO16_LE(ptr) (*((const U16 *)(ptr)))
+-#else
+-#define U8TO16_LE(ptr) (\
+- (U16)(ptr)[1] << 8 | \
+- (U16)(ptr)[0] \
+-)
+-#endif
+-#endif
+-
+ /* Find best way to ROTL32/ROTL64 */
+ #if defined(_MSC_VER)
+ #include <stdlib.h> /* Microsoft put _rotl declaration in here */
+diff --git a/zaphod32_hash.h b/zaphod32_hash.h
+index c9b60ccb32..2fb391a233 100644
+--- zaphod32_hash.h.orig
++++ zaphod32_hash.h
+@@ -74,41 +74,6 @@
+ #define STMT_END while(0)
+ #endif
+
+-#ifndef ZAPHOD32_ALLOW_UNALIGNED_AND_LITTLE_ENDIAN
+-/* ZAPHOD32_ALLOW_UNALIGNED_AND_LITTLE_ENDIAN only matters if nothing has defined U8TO64_LE etc,
+- * and when built with Perl these should be defined before this file is loaded.
+- */
+-#ifdef U32_ALIGNMENT_REQUIRED
+-#define ZAPHOD32_ALLOW_UNALIGNED_AND_LITTLE_ENDIAN 0
+-#else
+-#define ZAPHOD32_ALLOW_UNALIGNED_AND_LITTLE_ENDIAN 1
+-#endif
+-#endif
+-
+-#ifndef U8TO32_LE
+-#if ZAPHOD32_ALLOW_UNALIGNED_AND_LITTLE_ENDIAN
+-#define U8TO32_LE(ptr) (*((const U32 *)(ptr)))
+-#else
+-#define U8TO32_LE(ptr) (\
+- (U32)(ptr)[3] << 24 | \
+- (U32)(ptr)[2] << 16 | \
+- (U32)(ptr)[1] << 8 | \
+- (U32)(ptr)[0] \
+-)
+-#endif
+-#endif
+-
+-#ifndef U8TO16_LE
+-#if ZAPHOD32_ALLOW_UNALIGNED_AND_LITTLE_ENDIAN
+-#define U8TO16_LE(ptr) (*((const U16 *)(ptr)))
+-#else
+-#define U8TO16_LE(ptr) (\
+- (U16)(ptr)[1] << 8 | \
+- (U16)(ptr)[0] \
+-)
+-#endif
+-#endif
+-
+ /* This is two marsaglia xor-shift permutes, with a prime-multiple
+ * sandwiched inside. The end result of doing this twice with different
+ * primes is a completely avalanched v. */
Home |
Main Index |
Thread Index |
Old Index