Skip to content

Instantly share code, notes, and snippets.

@m1lkweed
Created April 7, 2022 12:45
Show Gist options
  • Save m1lkweed/8425c652a7b4cdbec19de3f7d5034202 to your computer and use it in GitHub Desktop.
Save m1lkweed/8425c652a7b4cdbec19de3f7d5034202 to your computer and use it in GitHub Desktop.
Guarantee a call to memset, even when optimizing
#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