diff options
| author | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2026-02-12 00:00:00 +0000 |
|---|---|---|
| committer | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2026-02-12 17:38:49 +0500 |
| commit | 839151eaaad24771892afaae6bac690e31e58384 (patch) | |
| tree | e292449d621f7a1d503b975984a2aca240dd2d8f /C | |
| parent | 5e96a8279489832924056b1fa82f29d5837c9469 (diff) | |
| download | 7zip-26.00.tar.gz 7zip-26.00.tar.bz2 7zip-26.00.zip | |
Diffstat (limited to 'C')
| -rw-r--r-- | C/7zVersion.h | 10 | ||||
| -rw-r--r-- | C/7zWindows.h | 10 | ||||
| -rw-r--r-- | C/7zip_gcc_c.mak | 2 | ||||
| -rw-r--r-- | C/CpuArch.c | 4 | ||||
| -rw-r--r-- | C/CpuArch.h | 19 | ||||
| -rw-r--r-- | C/HuffEnc.c | 9 | ||||
| -rw-r--r-- | C/HuffEnc.h | 2 | ||||
| -rw-r--r-- | C/Xxh64.c | 98 |
8 files changed, 120 insertions, 34 deletions
diff --git a/C/7zVersion.h b/C/7zVersion.h index b6142e9..770370a 100644 --- a/C/7zVersion.h +++ b/C/7zVersion.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #define MY_VER_MAJOR 25 | 1 | #define MY_VER_MAJOR 26 |
| 2 | #define MY_VER_MINOR 1 | 2 | #define MY_VER_MINOR 0 |
| 3 | #define MY_VER_BUILD 0 | 3 | #define MY_VER_BUILD 0 |
| 4 | #define MY_VERSION_NUMBERS "25.01" | 4 | #define MY_VERSION_NUMBERS "26.00" |
| 5 | #define MY_VERSION MY_VERSION_NUMBERS | 5 | #define MY_VERSION MY_VERSION_NUMBERS |
| 6 | 6 | ||
| 7 | #ifdef MY_CPU_NAME | 7 | #ifdef MY_CPU_NAME |
| @@ -10,12 +10,12 @@ | |||
| 10 | #define MY_VERSION_CPU MY_VERSION | 10 | #define MY_VERSION_CPU MY_VERSION |
| 11 | #endif | 11 | #endif |
| 12 | 12 | ||
| 13 | #define MY_DATE "2025-08-03" | 13 | #define MY_DATE "2026-02-12" |
| 14 | #undef MY_COPYRIGHT | 14 | #undef MY_COPYRIGHT |
| 15 | #undef MY_VERSION_COPYRIGHT_DATE | 15 | #undef MY_VERSION_COPYRIGHT_DATE |
| 16 | #define MY_AUTHOR_NAME "Igor Pavlov" | 16 | #define MY_AUTHOR_NAME "Igor Pavlov" |
| 17 | #define MY_COPYRIGHT_PD "Igor Pavlov : Public domain" | 17 | #define MY_COPYRIGHT_PD "Igor Pavlov : Public domain" |
| 18 | #define MY_COPYRIGHT_CR "Copyright (c) 1999-2025 Igor Pavlov" | 18 | #define MY_COPYRIGHT_CR "Copyright (c) 1999-2026 Igor Pavlov" |
| 19 | 19 | ||
| 20 | #ifdef USE_COPYRIGHT_CR | 20 | #ifdef USE_COPYRIGHT_CR |
| 21 | #define MY_COPYRIGHT MY_COPYRIGHT_CR | 21 | #define MY_COPYRIGHT MY_COPYRIGHT_CR |
diff --git a/C/7zWindows.h b/C/7zWindows.h index 42c6db8..381159e 100644 --- a/C/7zWindows.h +++ b/C/7zWindows.h | |||
| @@ -1,11 +1,17 @@ | |||
| 1 | /* 7zWindows.h -- StdAfx | 1 | /* 7zWindows.h -- Windows.h and related code |
| 2 | 2023-04-02 : Igor Pavlov : Public domain */ | 2 | Igor Pavlov : Public domain */ |
| 3 | 3 | ||
| 4 | #ifndef ZIP7_INC_7Z_WINDOWS_H | 4 | #ifndef ZIP7_INC_7Z_WINDOWS_H |
| 5 | #define ZIP7_INC_7Z_WINDOWS_H | 5 | #define ZIP7_INC_7Z_WINDOWS_H |
| 6 | 6 | ||
| 7 | #ifdef _WIN32 | 7 | #ifdef _WIN32 |
| 8 | 8 | ||
| 9 | #if defined(_MSC_VER) && _MSC_VER >= 1950 && !defined(__clang__) // VS2026 | ||
| 10 | // <Windows.h> and some another windows files need that option | ||
| 11 | // VS2026: wtypesbase.h: warning C4865: 'tagCLSCTX': the underlying type will change from 'int' to 'unsigned int' when '/Zc:enumTypes' is specified on the command line | ||
| 12 | #pragma warning(disable : 4865) | ||
| 13 | #endif | ||
| 14 | |||
| 9 | #if defined(__clang__) | 15 | #if defined(__clang__) |
| 10 | # pragma clang diagnostic push | 16 | # pragma clang diagnostic push |
| 11 | #endif | 17 | #endif |
diff --git a/C/7zip_gcc_c.mak b/C/7zip_gcc_c.mak index 195d23d..006cfe0 100644 --- a/C/7zip_gcc_c.mak +++ b/C/7zip_gcc_c.mak | |||
| @@ -106,7 +106,7 @@ DEL_OBJ_EXE = -$(RM) $(O)\*.o $(O)\$(PROG).exe $(O)\$(PROG).dll | |||
| 106 | endif | 106 | endif |
| 107 | 107 | ||
| 108 | 108 | ||
| 109 | LIB2 = -lOle32 -loleaut32 -luuid -ladvapi32 -lUser32 -lShell32 | 109 | LIB2 = -lole32 -loleaut32 -luuid -ladvapi32 -luser32 -lshell32 |
| 110 | 110 | ||
| 111 | CFLAGS_EXTRA = -DUNICODE -D_UNICODE | 111 | CFLAGS_EXTRA = -DUNICODE -D_UNICODE |
| 112 | # -Wno-delete-non-virtual-dtor | 112 | # -Wno-delete-non-virtual-dtor |
diff --git a/C/CpuArch.c b/C/CpuArch.c index 6e02551..342280d 100644 --- a/C/CpuArch.c +++ b/C/CpuArch.c | |||
| @@ -859,7 +859,7 @@ BoolInt CPU_IsSupported_AES (void) { return APPLE_CRYPTO_SUPPORT_VAL; } | |||
| 859 | 859 | ||
| 860 | #if defined(__GLIBC__) && (__GLIBC__ * 100 + __GLIBC_MINOR__ >= 216) | 860 | #if defined(__GLIBC__) && (__GLIBC__ * 100 + __GLIBC_MINOR__ >= 216) |
| 861 | #define Z7_GETAUXV_AVAILABLE | 861 | #define Z7_GETAUXV_AVAILABLE |
| 862 | #else | 862 | #elif !defined(__QNXNTO__) |
| 863 | // #pragma message("=== is not NEW GLIBC === ") | 863 | // #pragma message("=== is not NEW GLIBC === ") |
| 864 | #if defined __has_include | 864 | #if defined __has_include |
| 865 | #if __has_include (<sys/auxv.h>) | 865 | #if __has_include (<sys/auxv.h>) |
| @@ -877,7 +877,7 @@ BoolInt CPU_IsSupported_AES (void) { return APPLE_CRYPTO_SUPPORT_VAL; } | |||
| 877 | 877 | ||
| 878 | #ifdef USE_HWCAP | 878 | #ifdef USE_HWCAP |
| 879 | 879 | ||
| 880 | #if defined(__FreeBSD__) | 880 | #if defined(__FreeBSD__) || defined(__OpenBSD__) |
| 881 | static unsigned long MY_getauxval(int aux) | 881 | static unsigned long MY_getauxval(int aux) |
| 882 | { | 882 | { |
| 883 | unsigned long val; | 883 | unsigned long val; |
diff --git a/C/CpuArch.h b/C/CpuArch.h index 1690a5b..c682720 100644 --- a/C/CpuArch.h +++ b/C/CpuArch.h | |||
| @@ -31,7 +31,12 @@ MY_CPU_64BIT means that processor can work with 64-bit registers. | |||
| 31 | #define MY_CPU_NAME "x32" | 31 | #define MY_CPU_NAME "x32" |
| 32 | #define MY_CPU_SIZEOF_POINTER 4 | 32 | #define MY_CPU_SIZEOF_POINTER 4 |
| 33 | #else | 33 | #else |
| 34 | #define MY_CPU_NAME "x64" | 34 | #if defined(__APX_EGPR__) || defined(__EGPR__) |
| 35 | #define MY_CPU_NAME "x64-apx" | ||
| 36 | #define MY_CPU_AMD64_APX | ||
| 37 | #else | ||
| 38 | #define MY_CPU_NAME "x64" | ||
| 39 | #endif | ||
| 35 | #define MY_CPU_SIZEOF_POINTER 8 | 40 | #define MY_CPU_SIZEOF_POINTER 8 |
| 36 | #endif | 41 | #endif |
| 37 | #define MY_CPU_64BIT | 42 | #define MY_CPU_64BIT |
| @@ -596,8 +601,20 @@ problem-4 : performace: | |||
| 596 | #define SetBe32a(p, v) { *(UInt32 *)(void *)(p) = (v); } | 601 | #define SetBe32a(p, v) { *(UInt32 *)(void *)(p) = (v); } |
| 597 | #define SetBe16a(p, v) { *(UInt16 *)(void *)(p) = (v); } | 602 | #define SetBe16a(p, v) { *(UInt16 *)(void *)(p) = (v); } |
| 598 | 603 | ||
| 604 | // gcc and clang for powerpc can transform load byte access to load reverse word access. | ||
| 605 | // sp we can use byte access instead of word access. Z7_BSWAP64 cab be slow | ||
| 606 | #if 1 && defined(Z7_CPU_FAST_BSWAP_SUPPORTED) && defined(MY_CPU_64BIT) | ||
| 607 | #define GetUi64a(p) Z7_BSWAP64 (*(const UInt64 *)(const void *)(p)) | ||
| 608 | #else | ||
| 599 | #define GetUi64a(p) GetUi64(p) | 609 | #define GetUi64a(p) GetUi64(p) |
| 610 | #endif | ||
| 611 | |||
| 612 | #if 1 && defined(Z7_CPU_FAST_BSWAP_SUPPORTED) | ||
| 613 | #define GetUi32a(p) Z7_BSWAP32 (*(const UInt32 *)(const void *)(p)) | ||
| 614 | #else | ||
| 600 | #define GetUi32a(p) GetUi32(p) | 615 | #define GetUi32a(p) GetUi32(p) |
| 616 | #endif | ||
| 617 | |||
| 601 | #define GetUi16a(p) GetUi16(p) | 618 | #define GetUi16a(p) GetUi16(p) |
| 602 | #define SetUi32a(p, v) SetUi32(p, v) | 619 | #define SetUi32a(p, v) SetUi32(p, v) |
| 603 | #define SetUi16a(p, v) SetUi16(p, v) | 620 | #define SetUi16a(p, v) SetUi16(p, v) |
diff --git a/C/HuffEnc.c b/C/HuffEnc.c index cbf8c22..297b41a 100644 --- a/C/HuffEnc.c +++ b/C/HuffEnc.c | |||
| @@ -13,7 +13,7 @@ Igor Pavlov : Public domain */ | |||
| 13 | #define NUM_BITS 10 | 13 | #define NUM_BITS 10 |
| 14 | #define MASK ((1u << NUM_BITS) - 1) | 14 | #define MASK ((1u << NUM_BITS) - 1) |
| 15 | #define FREQ_MASK (~(UInt32)MASK) | 15 | #define FREQ_MASK (~(UInt32)MASK) |
| 16 | #define NUM_COUNTERS (48 * 2) | 16 | #define NUM_COUNTERS (104 * 2) // (80 * 2) or (128 * 2) : ((prime_number + 1) * 2) for smaller code. |
| 17 | 17 | ||
| 18 | #if 1 && (defined(MY_CPU_LE) || defined(MY_CPU_BE)) | 18 | #if 1 && (defined(MY_CPU_LE) || defined(MY_CPU_BE)) |
| 19 | #if defined(MY_CPU_LE) | 19 | #if defined(MY_CPU_LE) |
| @@ -95,9 +95,10 @@ void Huffman_Generate(const UInt32 *freqs, UInt32 *p, Byte *lens, unsigned numSy | |||
| 95 | counters[1] = 0; | 95 | counters[1] = 0; |
| 96 | for (i = 2; i != NUM_COUNTERS; i += 2) | 96 | for (i = 2; i != NUM_COUNTERS; i += 2) |
| 97 | { | 97 | { |
| 98 | unsigned c; | 98 | const unsigned c0 = (counters )[i]; |
| 99 | c = (counters )[i]; (counters )[i] = num; num += c; | 99 | const unsigned c1 = (counters + 1)[i]; |
| 100 | c = (counters + 1)[i]; (counters + 1)[i] = num; num += c; | 100 | (counters )[i] = num; num += c0; |
| 101 | (counters + 1)[i] = num; num += c1; | ||
| 101 | } | 102 | } |
| 102 | counters[0] = num; // we want to write (freq==0) symbols to the end of (p) array | 103 | counters[0] = num; // we want to write (freq==0) symbols to the end of (p) array |
| 103 | { | 104 | { |
diff --git a/C/HuffEnc.h b/C/HuffEnc.h index 2217f55..45567d0 100644 --- a/C/HuffEnc.h +++ b/C/HuffEnc.h | |||
| @@ -16,7 +16,7 @@ Conditions: | |||
| 16 | 1 <= maxLen <= 16 = Z7_HUFFMAN_LEN_MAX | 16 | 1 <= maxLen <= 16 = Z7_HUFFMAN_LEN_MAX |
| 17 | Num_Items(p) >= HUFFMAN_TEMP_SIZE(num) | 17 | Num_Items(p) >= HUFFMAN_TEMP_SIZE(num) |
| 18 | */ | 18 | */ |
| 19 | void Huffman_Generate(const UInt32 *freqs, UInt32 *p, Byte *lens, UInt32 num, UInt32 maxLen); | 19 | void Huffman_Generate(const UInt32 *freqs, UInt32 *p, Byte *lens, unsigned num, unsigned maxLen); |
| 20 | 20 | ||
| 21 | EXTERN_C_END | 21 | EXTERN_C_END |
| 22 | 22 | ||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Xxh64.c -- XXH64 hash calculation | 1 | /* Xxh64.c -- XXH64 hash calculation |
| 2 | original code: Copyright (c) Yann Collet. | 2 | original code: Copyright (c) Yann Collet. |
| 3 | 2023-08-18 : modified by Igor Pavlov. | 3 | modified by Igor Pavlov. |
| 4 | This source code is licensed under BSD 2-Clause License. | 4 | This source code is licensed under BSD 2-Clause License. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| @@ -27,6 +27,14 @@ void Xxh64State_Init(CXxh64State *p) | |||
| 27 | 27 | ||
| 28 | #if !defined(MY_CPU_64BIT) && defined(MY_CPU_X86) && defined(_MSC_VER) | 28 | #if !defined(MY_CPU_64BIT) && defined(MY_CPU_X86) && defined(_MSC_VER) |
| 29 | #define Z7_XXH64_USE_ASM | 29 | #define Z7_XXH64_USE_ASM |
| 30 | #elif !defined(MY_CPU_LE_UNALIGN_64) // && defined (MY_CPU_LE) | ||
| 31 | #define Z7_XXH64_USE_ALIGNED | ||
| 32 | #endif | ||
| 33 | |||
| 34 | #ifdef Z7_XXH64_USE_ALIGNED | ||
| 35 | #define Xxh64State_UpdateBlocks_Unaligned_Select Xxh64State_UpdateBlocks_Unaligned | ||
| 36 | #else | ||
| 37 | #define Xxh64State_UpdateBlocks_Unaligned_Select Xxh64State_UpdateBlocks | ||
| 30 | #endif | 38 | #endif |
| 31 | 39 | ||
| 32 | #if !defined(MY_CPU_64BIT) && defined(MY_CPU_X86) \ | 40 | #if !defined(MY_CPU_64BIT) && defined(MY_CPU_X86) \ |
| @@ -188,32 +196,76 @@ Xxh64State_UpdateBlocks(CXxh64State *p, const void *data, const void *end) | |||
| 188 | 196 | ||
| 189 | #else | 197 | #else |
| 190 | 198 | ||
| 199 | #ifdef Z7_XXH64_USE_ALIGNED | ||
| 200 | static | ||
| 201 | #endif | ||
| 191 | void | 202 | void |
| 192 | Z7_NO_INLINE | 203 | Z7_NO_INLINE |
| 193 | Z7_FASTCALL | 204 | Z7_FASTCALL |
| 194 | Xxh64State_UpdateBlocks(CXxh64State *p, const void *_data, const void *end) | 205 | Xxh64State_UpdateBlocks_Unaligned_Select(CXxh64State *p, const void *_data, const void *end) |
| 195 | { | 206 | { |
| 196 | const Byte *data = (const Byte *)_data; | 207 | const Byte *data = (const Byte *)_data; |
| 197 | UInt64 v[4]; | 208 | UInt64 v0, v1, v2, v3; |
| 198 | v[0] = p->v[0]; | 209 | v0 = p->v[0]; |
| 199 | v[1] = p->v[1]; | 210 | v1 = p->v[1]; |
| 200 | v[2] = p->v[2]; | 211 | v2 = p->v[2]; |
| 201 | v[3] = p->v[3]; | 212 | v3 = p->v[3]; |
| 202 | do | 213 | do |
| 203 | { | 214 | { |
| 204 | v[0] = Xxh64_Round(v[0], GetUi64(data)); data += 8; | 215 | v0 = Xxh64_Round(v0, GetUi64(data)); data += 8; |
| 205 | v[1] = Xxh64_Round(v[1], GetUi64(data)); data += 8; | 216 | v1 = Xxh64_Round(v1, GetUi64(data)); data += 8; |
| 206 | v[2] = Xxh64_Round(v[2], GetUi64(data)); data += 8; | 217 | v2 = Xxh64_Round(v2, GetUi64(data)); data += 8; |
| 207 | v[3] = Xxh64_Round(v[3], GetUi64(data)); data += 8; | 218 | v3 = Xxh64_Round(v3, GetUi64(data)); data += 8; |
| 208 | } | 219 | } |
| 209 | while (data != end); | 220 | while (data != end); |
| 210 | p->v[0] = v[0]; | 221 | p->v[0] = v0; |
| 211 | p->v[1] = v[1]; | 222 | p->v[1] = v1; |
| 212 | p->v[2] = v[2]; | 223 | p->v[2] = v2; |
| 213 | p->v[3] = v[3]; | 224 | p->v[3] = v3; |
| 214 | } | 225 | } |
| 215 | 226 | ||
| 216 | #endif | 227 | |
| 228 | #ifdef Z7_XXH64_USE_ALIGNED | ||
| 229 | |||
| 230 | static | ||
| 231 | void | ||
| 232 | Z7_NO_INLINE | ||
| 233 | Z7_FASTCALL | ||
| 234 | Xxh64State_UpdateBlocks_Aligned(CXxh64State *p, const void *_data, const void *end) | ||
| 235 | { | ||
| 236 | const Byte *data = (const Byte *)_data; | ||
| 237 | UInt64 v0, v1, v2, v3; | ||
| 238 | v0 = p->v[0]; | ||
| 239 | v1 = p->v[1]; | ||
| 240 | v2 = p->v[2]; | ||
| 241 | v3 = p->v[3]; | ||
| 242 | do | ||
| 243 | { | ||
| 244 | v0 = Xxh64_Round(v0, GetUi64a(data)); data += 8; | ||
| 245 | v1 = Xxh64_Round(v1, GetUi64a(data)); data += 8; | ||
| 246 | v2 = Xxh64_Round(v2, GetUi64a(data)); data += 8; | ||
| 247 | v3 = Xxh64_Round(v3, GetUi64a(data)); data += 8; | ||
| 248 | } | ||
| 249 | while (data != end); | ||
| 250 | p->v[0] = v0; | ||
| 251 | p->v[1] = v1; | ||
| 252 | p->v[2] = v2; | ||
| 253 | p->v[3] = v3; | ||
| 254 | } | ||
| 255 | |||
| 256 | void | ||
| 257 | Z7_NO_INLINE | ||
| 258 | Z7_FASTCALL | ||
| 259 | Xxh64State_UpdateBlocks(CXxh64State *p, const void *data, const void *end) | ||
| 260 | { | ||
| 261 | if (((unsigned)(ptrdiff_t)data & 7) == 0) | ||
| 262 | Xxh64State_UpdateBlocks_Aligned(p, data, end); | ||
| 263 | else | ||
| 264 | Xxh64State_UpdateBlocks_Unaligned(p, data, end); | ||
| 265 | } | ||
| 266 | |||
| 267 | #endif // Z7_XXH64_USE_ALIGNED | ||
| 268 | #endif // Z7_XXH64_USE_ASM | ||
| 217 | 269 | ||
| 218 | UInt64 Xxh64State_Digest(const CXxh64State *p, const void *_data, UInt64 count) | 270 | UInt64 Xxh64State_Digest(const CXxh64State *p, const void *_data, UInt64 count) |
| 219 | { | 271 | { |
| @@ -306,12 +358,22 @@ void Xxh64_Update(CXxh64 *p, const void *_data, size_t size) | |||
| 306 | while (--rem); | 358 | while (--rem); |
| 307 | if (cnt != 32) | 359 | if (cnt != 32) |
| 308 | return; | 360 | return; |
| 309 | Xxh64State_UpdateBlocks(&p->state, p->buf64, &p->buf64[4]); | 361 | #ifdef Z7_XXH64_USE_ALIGNED |
| 362 | Xxh64State_UpdateBlocks_Aligned | ||
| 363 | #else | ||
| 364 | Xxh64State_UpdateBlocks_Unaligned_Select | ||
| 365 | #endif | ||
| 366 | (&p->state, p->buf64, &p->buf64[4]); | ||
| 310 | } | 367 | } |
| 311 | 368 | ||
| 312 | if (size &= ~(size_t)31) | 369 | if (size &= ~(size_t)31) |
| 313 | { | 370 | { |
| 314 | Xxh64State_UpdateBlocks(&p->state, data, data + size); | 371 | #ifdef Z7_XXH64_USE_ALIGNED |
| 372 | if (((unsigned)(ptrdiff_t)data & 7) == 0) | ||
| 373 | Xxh64State_UpdateBlocks_Aligned(&p->state, data, data + size); | ||
| 374 | else | ||
| 375 | #endif | ||
| 376 | Xxh64State_UpdateBlocks_Unaligned_Select(&p->state, data, data + size); | ||
| 315 | data += size; | 377 | data += size; |
| 316 | } | 378 | } |
| 317 | 379 | ||
