Skip to content

Commit 2e9c75d

Browse files
author
Siva Chandra Reddy
committed
[libc] Use __builtin_ctzll instead of __builtin_ctzl in elements_x86.h.
__builtin_ctzl takes an unsigned long argument which need not be 64-bit long on all platforms. Using __builtin_ctzll, which takes an unsigned long long argument, ensures that 64-bit values will be handled on a wider range of platforms. Without this change, the test corresponding to M512 fails in Windows. Reviewed By: gchatelet Differential Revision: https://reviews.llvm.org/D104897
1 parent fdd4c19 commit 2e9c75d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libc/src/string/memory_utils/elements_x86.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ template <typename Base> struct Vector : public Base {
4646
}
4747

4848
static int CharDiff(const char *a, const char *b, uint64_t mask) {
49-
const size_t diff_index = __builtin_ctzl(mask);
49+
const size_t diff_index = __builtin_ctzll(mask);
5050
const int ca = (unsigned char)a[diff_index];
5151
const int cb = (unsigned char)b[diff_index];
5252
return ca - cb;

0 commit comments

Comments
 (0)