Skip to content

Instantly share code, notes, and snippets.

@j0inty
Created September 20, 2016 19:58
Show Gist options
  • Save j0inty/5353d5c77b49434c329df10528762cf9 to your computer and use it in GitHub Desktop.
Save j0inty/5353d5c77b49434c329df10528762cf9 to your computer and use it in GitHub Desktop.
/**
* Guarantueed that the memory will set with c through the volatile instruction to the compiler.
*/
void *guaranteed_memset(void *v,int c,size_t n)
{
volatile char *p=v;
while (n--)
{
*p++=c;
}
return v;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment