avoid silly gcc warning

master
Daniel Kolesa 2018-01-17 22:58:34 +01:00
parent 45161b9837
commit 3f939f2e1a
1 changed files with 3 additions and 3 deletions

View File

@ -28,7 +28,8 @@ inline std::size_t tstrlen_impl(C const *p) noexcept {
C const *bp = p;
/* 1 unit or less per size_t, simple loop */
if constexpr(sizeof(C) >= sizeof(std::size_t)) {
goto sloop;
for (; *p; ++p) {}
return (p - bp);
}
/* need a pointer aligned to sizeof(size_t) */
for (; std::uintptr_t(p) % sizeof(std::size_t); ++p) {
@ -50,8 +51,7 @@ inline std::size_t tstrlen_impl(C const *p) noexcept {
for (; !(((*wp - Lbits) & ~*wp) & Hbits); ++wp) {}
p = reinterpret_cast<C const *>(wp);
}
sloop:
/* either all of the string if goto'd, or contains terminating zero */
/* go to terminating zero, by unit */
for (; *p; ++p) {}
return (p - bp);
}