[libc-commits] [PATCH] D104897: [libc] Use __builtin_ctzll instead of __builtin_ctzl in elements_x86.h.
Siva Chandra via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu Jun 24 23:03:58 PDT 2021
sivachandra created this revision.
sivachandra added a reviewer: gchatelet.
Herald added subscribers: libc-commits, ecnelises, tschuett.
Herald added a project: libc-project.
sivachandra requested review of this revision.
__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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D104897
Files:
libc/src/string/memory_utils/elements_x86.h
Index: libc/src/string/memory_utils/elements_x86.h
===================================================================
--- libc/src/string/memory_utils/elements_x86.h
+++ libc/src/string/memory_utils/elements_x86.h
@@ -46,7 +46,7 @@
}
static int CharDiff(const char *a, const char *b, uint64_t mask) {
- const size_t diff_index = __builtin_ctzl(mask);
+ const size_t diff_index = __builtin_ctzll(mask);
const int ca = (unsigned char)a[diff_index];
const int cb = (unsigned char)b[diff_index];
return ca - cb;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104897.354433.patch
Type: text/x-patch
Size: 538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20210625/5285c2f5/attachment.bin>
More information about the libc-commits
mailing list