summaryrefslogtreecommitdiff
path: root/src/string/memset.c
AgeCommit message (Collapse)AuthorLines
2017-08-29fix undefined behavior in memset due to missing sequence pointsRich Felker-4/+8
patch by Pascal Cuoq.
2013-08-27optimized C memsetRich Felker-12/+77
this version of memset is optimized both for small and large values of n, and makes no misaligned writes, so it is usable (and near-optimal) on all archs. it is capable of filling up to 52 or 56 bytes without entering a loop and with at most 7 branches, all of which can be fully predicted if memset is called multiple times with the same size. it also uses the attribute extension to inform the compiler that it is violating the aliasing rules, unlike the previous code which simply assumed it was safe to violate the aliasing rules since translation unit boundaries hide the violations from the compiler. for non-GNUC compilers, 100% portable fallback code in the form of a naive loop is provided. I intend to eventually apply this approach to all of the string/memory functions which are doing word-at-a-time accesses.
2011-02-12initial check-in, version 0.5.0v0.5.0Rich Felker-0/+21