Created
April 7, 2022 12:45
-
-
Save m1lkweed/8425c652a7b4cdbec19de3f7d5034202 to your computer and use it in GitHub Desktop.
Guarantee a call to memset, even when optimizing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stddef.h> | |
static inline void *memclear(void *dest, size_t len){ | |
asm inline volatile("call memset" | |
: | |
:"r"(dest), | |
"r"(0), | |
"r"(len) | |
: | |
); | |
return dest; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment