From 6484508ffbb18831d70dfe7c6ec7400f7515bc4e Mon Sep 17 00:00:00 2001 From: Zhou Yunfei Date: Fri, 12 Dec 2025 14:01:42 +0800 Subject: [PATCH] limit RISC-V FindMatchLength optimizations to 64-bit Add `__riscv_xlen == 64` check to ensure the optimized FindMatchLength routine is only enabled on 64-bit RISC-V platforms. Signed-off-by: Zhou Yunfei --- snappy-internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snappy-internal.h b/snappy-internal.h index 00b2db5..9be0542 100644 --- a/snappy-internal.h +++ b/snappy-internal.h @@ -194,7 +194,7 @@ char* CompressFragment(const char* input, // riscv and little-endian cpu choose this routinue can be done faster too. #if !SNAPPY_IS_BIG_ENDIAN && \ (defined(__x86_64__) || defined(_M_X64) || defined(ARCH_PPC) || \ - defined(ARCH_ARM) || defined(__riscv)) + defined(ARCH_ARM) || (defined(__riscv) && (__riscv_xlen == 64))) static inline std::pair FindMatchLength(const char* s1, const char* s2, const char* s2_limit,