Skip to content

Commit

Permalink
Remove tzcnt_u32
Browse files Browse the repository at this point in the history
  • Loading branch information
Antares0982 committed Dec 25, 2024
1 parent 363b560 commit 3fb954d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
2 changes: 1 addition & 1 deletion src/encode/encode_unicode_impl.inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ force_inline UnicodeVector *VECTOR_WRITE_UNICODE_IMPL(UnicodeVector **restrict v
bit_mask = to_bitmask_128(mask);
#endif // COMPILE_READ_UCS_LEVEL
assert(bit_mask);
u32 done_count = tzcnt_u32((u32) bit_mask) / sizeof(_FROM_TYPE);
u32 done_count = u32_tz_bits((u32) bit_mask) / sizeof(_FROM_TYPE);
// vec = VECTOR_WRITE_ESCAPE_IMPL(vec_addr, src, CHECK_COUNT_MAX, len - CHECK_COUNT_MAX);
// src += CHECK_COUNT_MAX;
#endif
Expand Down
24 changes: 0 additions & 24 deletions src/simd/simd_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -449,28 +449,4 @@ force_inline SIMD_HALF_TYPE load_half(const void *src) {

#endif // SIMD_BIT_SIZE > 128

/*==============================================================================
* TZCNT.
*============================================================================*/
force_inline u32 tzcnt_u32(u32 x) {
// never pass a zero here.
assert(x);
#if __BMI__
// real gcc check from yyjson
#if !defined(__clang__) && !defined(__INTEL_COMPILER) && !defined(__ICC) && defined(__GNUC__)
return __tzcnt_u32(x);
#else
return _mm_tzcnt_32(x);
#endif
#else
#if defined(_MSC_VER)
unsigned long index = 0;
_BitScanForward(&index, x);
return index;
#else
return __builtin_ctz(x);
#endif
#endif
}

#endif // ENCODE_SIMD_IMPL_H

0 comments on commit 3fb954d

Please sign in to comment.