We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6e5b379 commit 9ac3a19Copy full SHA for 9ac3a19
libc-top-half/musl/src/string/strlen.c
@@ -16,8 +16,10 @@ size_t strlen(const char *s)
16
#if defined(__wasm_simd128__) && defined(__wasilibc_simd_string)
17
// strlen must stop as soon as it finds the terminator.
18
// Aligning ensures loads beyond the terminator are safe.
19
+ // Casting through uintptr_t makes this implementation-defined,
20
+ // rather than undefined behavior.
21
uintptr_t align = (uintptr_t)s % sizeof(v128_t);
- const v128_t *v = (v128_t *)(s - align);
22
+ const v128_t *v = (v128_t *)((uintptr_t)s - align);
23
24
for (;;) {
25
// Bitmask is slow on AArch64, all_true is much faster.
0 commit comments