Yann Collet
54e9d46db4
added __clang__ to compiler-specific alignment attribute
...
when clang is used within msvc, `__GNUC__` isn't defined,
so testing `__clang__` explicitly is required.
2025-02-05 13:48:24 -08:00
Yann Collet
bcf404c0ab
changed C11 keyword to _Alignas
...
so that it doesn't depend on #include
2025-02-05 13:25:14 -08:00
Yann Collet
26a2b5d5df
Merge pull request #4265 from pps83/static-bmi2-check
...
Check `STATIC_BMI2` instead of `STATIC_BMI2 == 1`
2025-01-31 14:39:20 -08:00
Pavel P
0cda0100ea
fix formatting
2025-01-24 03:03:22 +02:00
Pavel P
f7e8fc339b
Check STATIC_BMI2
instead of STATIC_BMI2 == 1
2025-01-24 03:03:21 +02:00
Pavel P
0a183620a3
Reorder __BMI2__ check
...
+ if `__BMI2__` defined, then set STATIC_BMI2 for all compilers
+ use `defined(_MSC_VER) && defined(__AVX2__)` as fallback for ms compiler
2025-01-24 03:02:47 +02:00
Pavel P
d486ccc9e9
Update comment for STATIC_BMI2 macro
2025-01-24 03:02:47 +02:00
Pavel P
1b15e888fc
Move STATIC_BMI2 block as-is to portability_macros.h
2025-01-24 03:02:46 +02:00
Yann Collet
a7b59bcb7f
Merge pull request #4257 from pps83/dev-x64test
...
Use _M_X64 only without mixing with _M_AMD64
2025-01-23 12:50:27 -08:00
Yann Collet
55c0c5bdca
Merge pull request #4258 from pps83/dev-ZSTD_ALIGNED
...
Implement ZSTD_ALIGNED for ms compiler
2025-01-22 15:09:35 -08:00
Pavel P
a0872a8372
Implement ZSTD_ALIGNED for ms compiler
2025-01-21 02:33:25 +02:00
Pavel P
6c1d1cc600
Use _M_X64 only without mixing with _M_AMD64
2025-01-21 02:27:39 +02:00
Yann Collet
48b186f76b
Merge pull request #4253 from facebook/BitContainerType
...
minor: use BitContainerType when appropriate
2025-01-19 18:35:36 -08:00
Yann Collet
82346b92bb
minor: generalize BitContainerType
...
technically equivalent to `size_t`,
but it's the proper type for underlying register representation.
This makes it possible to control register type, and therefore size, independently from `size_t`,
which can be useful on systems where `size_t` is 32-bit, while the architecture supports 64-bit registers.
2025-01-19 18:05:57 -08:00
Yann Collet
4bbf4a285d
enable DYNAMIC_BMI2 by default on x86 (32-bit mode)
...
so far was only enabled for x64 (64-bit mode)
2025-01-19 08:11:59 -08:00
Yann Collet
a556559841
no longer limit automated BMI2 detection to x64
...
this was previously no triggered in x86 32-bit mode,
due to a limitation in `bitstream.h`, that was fixed in #4248 .
Now, `bmi2` will be automatically detected and triggered
at compilation time, if the corresponding instruction set is enabled,
even in 32-bit mode.
Also: updated library documentation, to feature STATIC_BMI2 build variable
2025-01-19 00:08:57 -08:00
Yann Collet
27d7940631
minor: cosmetic, indentation
2025-01-18 22:49:16 -08:00
Yann Collet
9efb09749b
added a CI test for x86 32-bit + avx2 combination
...
which is expected to be quite rare, but nonetheless possible.
This test is initially expected to fail, before integration of #4248 fix
2025-01-18 22:49:16 -08:00
Yann Collet
a469e7c083
Merge pull request #4248 from pps83/dev-bzhi32
...
Use _bzhi_u32 for 32-bit builds when building with STATIC_BMI2
2025-01-18 22:48:24 -08:00
Pavel P
fcd684b9b4
update sizeof check
2025-01-19 02:37:35 +02:00
Pavel P
d60c4d75e9
remove unrelated changes
2025-01-19 02:36:00 +02:00
Pavel P
462484d5dc
change to BitContainerType
2025-01-19 02:34:41 +02:00
Pavel P
26e5fb3614
handle 32bit size_t when building for x64
2025-01-18 23:37:50 +02:00
Pavel P
936927a427
handle 32bit size_t when building for x64
2025-01-18 23:30:55 +02:00
Pavel P
ee17f4c6d2
Use _bzhi_u32 for 32-bit builds when building with STATIC_BMI2
...
`_bzhi_u64` is available only for 64-bit builds, while `BIT_getLowerBits` expects `nbBits` to be less than `BIT_MASK_SIZE` (`BIT_MASK_SIZE` is 32)
2025-01-18 21:33:04 +02:00
Pavel P
46e17b805b
[asm] Enable x86_64 asm for windows builds
2025-01-18 05:33:08 +02:00
Yann Collet
8bff69af86
Alignment instruction ZSTD_ALIGNED() in common/compiler.h
2025-01-15 17:11:27 -08:00
Yann Collet
6f8e6f3c97
create new compilation macro ZSTD_ARCH_X86_AVX2
2025-01-15 17:11:27 -08:00
MessyHack
42d704ad5e
should check defined(_M_X64) not defined(_M_X86) when building with MSVC.
...
_M_X86 is only defined under MSVC 32Bit
_M_X64 is only defined under MSVC 64Bit
2025-01-10 22:47:48 -08:00
Victor Zhang
a610550e2c
Merge pull request #4218 from facebook/externC
...
Move #includes out of `extern "C"` blocks
2025-01-07 10:06:08 -08:00
Yann Collet
a2ff6ea784
improve ZSTD_getFrameHeader on skippable frames
...
now reports:
- the header size
- the magic variant (within @dictID field)
2024-12-29 12:26:04 -08:00
Yann Collet
b339efff2b
add dedicated error code for special case
...
ZSTD_compressSequencesAndLiterals() cannot produce an uncompressed block
2024-12-20 10:37:00 -08:00
Yann Collet
0a5c0807af
minor conversion warning fix
2024-12-20 10:36:59 -08:00
Yann Collet
477a01067f
codemod: symbolEncodingType_e -> SymbolEncodingType_e
2024-12-20 10:36:56 -08:00
Yann Collet
b4a40a845f
move Sequences definition to zstd_compress_internal.h
...
they should not be in common/zstd_internal.h,
since these definitions are not shared beyond lib/compress/.
2024-12-20 10:36:55 -08:00
Victor Zhang
8f49db5a02
Revert "Remove unnecessary extern C declarations from xxhash.h"
...
This reverts commit 10b9d81909f8631e3ac64bd45e3bdd04982e39d6.
2024-12-19 17:54:41 -08:00
Victor Zhang
10b9d81909
Remove unnecessary extern C declarations from xxhash.h
2024-12-19 16:54:32 -08:00
Victor Zhang
d0d5ce4c00
Remove extern C blocks from lib/* internal APIs (except xxhash.h)
2024-12-19 16:00:11 -08:00
Victor Zhang
d51e6072a8
Test: remove extern C from some lib/common files
2024-12-19 14:59:02 -08:00
Victor Zhang
a7bb6d6c49
Oopsie with xxhash.h [1/?]
2024-12-18 12:41:53 -08:00
Victor Zhang
07ffcc6b65
Separate xxhash includes from extern C blocks
2024-12-18 12:35:10 -08:00
Victor Zhang
63acf9a995
Oopsie with huf.h, debug.h
2024-12-18 09:56:50 -08:00
Victor Zhang
58a7f4b869
Oopsie with threading.h
2024-12-17 18:37:33 -08:00
Victor Zhang
5222dd87cf
Oopsie with fse.h
2024-12-17 18:11:58 -08:00
Victor Zhang
fc726da774
Move #includes out of extern "C"
blocks
...
Do some include shuffling for `**.h` files within lib, programs, tests, and zlibWrapper.
`lib/legacy` and `lib/deprecated` are untouched.
`#include`s within `extern "C"` blocks in .cpp files are untouched.
todo: shuffling for `xxhash.h`
2024-12-17 17:55:07 -08:00
郑苏波 (Super Zheng)
5e0a83ec25
Disallow 32-bit mode in clang section
...
Fix register %rbx is only available in 64-bit mode
2024-12-04 06:47:32 -08:00
Yann Collet
7bad787d8b
made ZSTD_isPower2() an inline function
2024-10-23 11:50:57 -07:00
Yann Collet
4ce91cbf2b
fixed workspace alignment on non 64-bit systems
2024-10-23 11:50:57 -07:00
Adenilson Cavalcanti
6dbd49bcd0
[riscv] Enable support for weak symbols
...
Both gcc and clang support weak symbols on RISC-V, therefore
let's enable it.
This should fix issue #4069 .
2024-08-06 16:55:32 -07:00
Adenilson Cavalcanti
c3c28c4d5a
[zstd][android] Fix build with NDK r27
...
The NDK cross compiler declares the target as __linux (which is
not technically incorrect), which triggers the enablement of _GNU_SOURCE
in the newly added code that requires the presence of qsort_r() used
in the COVER dictionary code.
Even though the NDK uses llvm/libc, it doesn't declare qsort_r()
in the stdlib.h header.
The build fix is to only activate the _GNU_SOURCE macro if the OS is
*not* Android, as then we will fallback to the C90 compliant code.
This patch should solve the reported issue number #4103 .
2024-07-29 17:13:58 -07:00