diff options
author | Mateusz Guzik <mjg@FreeBSD.org> | 2018-06-02 17:57:09 +0000 |
---|---|---|
committer | Mateusz Guzik <mjg@FreeBSD.org> | 2018-06-02 17:57:09 +0000 |
commit | 97e8984893905ab824659c12dcc6b8ffb44ac0ed (patch) | |
tree | 07f50aa0f42ccdd967abbca8366430fd295dcc1d /sys/libkern | |
parent | 13500cbb61cc2984494d78633b311ecc2dec4e1c (diff) | |
download | src-97e8984893905ab824659c12dcc6b8ffb44ac0ed.tar.gz src-97e8984893905ab824659c12dcc6b8ffb44ac0ed.zip |
libkern: tidy up memset
1. Remove special-casing of 0 as it just results in an extra function call.
This is clearly pessimal.
2. Drop the inline stuff. For the most part it is much better served with
__builtin_memset (coming later).
3. Move the declaration to systm.h to match other funcs.
Archs are encouraged to implement the variant for their own platform so that
this implementation can be dropped.
Notes
Notes:
svn path=/head/; revision=334533
Diffstat (limited to 'sys/libkern')
-rw-r--r-- | sys/libkern/memset.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/sys/libkern/memset.c b/sys/libkern/memset.c index c404233fe684..b2d64b21b90e 100644 --- a/sys/libkern/memset.c +++ b/sys/libkern/memset.c @@ -37,10 +37,7 @@ memset(void *b, int c, size_t len) { char *bb; - if (c == 0) - (bzero)(b, len); - else - for (bb = (char *)b; len--; ) - *bb++ = c; + for (bb = (char *)b; len--; ) + *bb++ = c; return (b); } |