]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Fix hash4Ptr for big endian (#3227)
authorQiongsi Wu <274595+qiongsiwu@users.noreply.github.com>
Mon, 1 Aug 2022 17:41:24 +0000 (13:41 -0400)
committerGitHub <noreply@github.com>
Mon, 1 Aug 2022 17:41:24 +0000 (10:41 -0700)
lib/compress/zstd_compress_internal.h

index 4771b15ba6c20461fd3c1397790a6df2dc202a40..baa726f7dff56c616250540d3d1ddacd5665078c 100644 (file)
@@ -759,7 +759,7 @@ MEM_STATIC size_t ZSTD_hash3Ptr(const void* ptr, U32 h) { return ZSTD_hash3(MEM_
 
 static const U32 prime4bytes = 2654435761U;
 static U32    ZSTD_hash4(U32 u, U32 h) { assert(h <= 32); return (u * prime4bytes) >> (32-h) ; }
-static size_t ZSTD_hash4Ptr(const void* ptr, U32 h) { return ZSTD_hash4(MEM_read32(ptr), h); }
+static size_t ZSTD_hash4Ptr(const void* ptr, U32 h) { return ZSTD_hash4(MEM_readLE32(ptr), h); }
 
 static const U64 prime5bytes = 889523592379ULL;
 static size_t ZSTD_hash5(U64 u, U32 h) { assert(h <= 64); return (size_t)(((u  << (64-40)) * prime5bytes) >> (64-h)) ; }