diff --git a/include/fluent-bit/flb_simd.h b/include/fluent-bit/flb_simd.h index 19e212c67b6..de789624ba6 100644 --- a/include/fluent-bit/flb_simd.h +++ b/include/fluent-bit/flb_simd.h @@ -100,6 +100,15 @@ typedef uint64_t flb_vector8; typedef uint8_t flb_vector8; #endif /* FLB_SIMD_DISABLED */ +/* RVV's instruction length is flexible and not fixed width. + * We assumed that VLEN which is the fundamental intsruction length is 128. + */ +#if defined(FLB_SIMD_RVV) +#define FLB_SIMD_VEC8_INST_LEN RVV_VEC8_INST_LEN +#else +#define FLB_SIMD_VEC8_INST_LEN sizeof(flb_vector8) +#endif + /* element-wise comparisons to a scalar */ static inline bool flb_vector8_has(const flb_vector8 v, const uint8_t c); static inline bool flb_vector8_has_zero(const flb_vector8 v); diff --git a/src/flb_utils.c b/src/flb_utils.c index 20d09b04d5c..21cee6268d6 100644 --- a/src/flb_utils.c +++ b/src/flb_utils.c @@ -801,11 +801,7 @@ int flb_utils_write_str(char *buf, int *off, size_t size, const char *str, size_ off_t offset = 0; char tmp[16]; char *p; -#if defined(FLB_SIMD_RVV) - const size_t inst_len = RVV_VEC8_INST_LEN; -#else - const size_t inst_len = sizeof(flb_vector8); -#endif + const size_t inst_len = FLB_SIMD_VEC8_INST_LEN; /* to encode codepoints > 0xFFFF */ uint16_t high;