|
Message-ID: <CAMRJFfL3ZnFdiW9_JS2p3mpvSLp_28zwmZDu3GbmNo+jkfdqsA@mail.gmail.com> Date: Wed, 20 Feb 2013 19:05:28 +0100 From: Jonas Wagner <jonas.wagner@...l.ch> To: musl@...ts.openwall.com Subject: Fwd: Alignment check in strlen Dear all, attached is a patch that makes the alignment check in strlen more consistent with the one in memcpy, and hopefully faster. In src/string/memcpy.c, I find the following: #define ALIGN (sizeof(size_t)-1) if (((uintptr_t)d & ALIGN) != ((uintptr_t)s & ALIGN)) goto misaligned; In src/string/strlen.c, a different check was used instead: #define ALIGN (sizeof(size_t)) for (; (uintptr_t)s % ALIGN; s++) if (!*s) return s-a; I do not think there is any particular reason for this difference. Best, Jonas Content of type "text/html" skipped Download attachment "0001-strlen-use-bitwise-AND-for-alignment-test-instead-of.patch" of type "application/octet-stream" (1018 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.