Skip to content

Commit

Permalink
liblzma: CRC64 CLMUL: Use __asm to work around a MSVC problem
Browse files Browse the repository at this point in the history
Thanks to Iouri Kharon for testing and the fix.
  • Loading branch information
Larhzu committed Jun 12, 2024
1 parent 0a62768 commit 8931e99
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/liblzma/check/crc64_fast.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ crc64_dispatch(const uint8_t *buf, size_t size, uint64_t crc)
extern LZMA_API(uint64_t)
lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc)
{
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__clang__) \
&& defined(_M_IX86)
// VS2015-2022 might corrupt the ebx register on 32-bit x86.
// This hack forces MSVC to store and restore ebx.
// This is only needed here, not in lzma_crc32().
__asm mov ebx, ebx
#endif

#if defined(CRC64_GENERIC) && defined(CRC64_ARCH_OPTIMIZED)
return crc64_func(buf, size, crc);

Expand Down

0 comments on commit 8931e99

Please sign in to comment.