diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 30a25ef9620d..ddebe0a68431 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -258,6 +258,12 @@ void hexdump(const void *ptr, int length, const char *hdr, int flags); #define ovbcopy(f, t, l) bcopy((f), (t), (l)) void bcopy(const void * _Nonnull from, void * _Nonnull to, size_t len); void bzero(void * _Nonnull buf, size_t len); +#define bzero(buf, len) ({ \ + if (__builtin_constant_p(len) && (len) <= 64) \ + __builtin_memset((buf), 0, (len)); \ + else \ + bzero((buf), (len)); \ +}) void explicit_bzero(void * _Nonnull, size_t); void *memcpy(void * _Nonnull to, const void * _Nonnull from, size_t len);