sysclk: make dvfs work

This commit is contained in:
souldbminersmwc
2026-02-11 19:09:55 -05:00
parent 11c456e00c
commit dd447553d4
7 changed files with 157 additions and 8 deletions

View File

@@ -0,0 +1,59 @@
#include "memmem.h"
void *memmem_impl(void *haystack, size_t haystacklen, const void *needle, size_t needlelen)
{
const unsigned char *cmpp;
const unsigned char *p;
const unsigned char *endp;
const unsigned char *q;
const unsigned char *endq;
unsigned char found;
if(haystack == NULL)
{
return NULL;
}
if(needle == NULL)
{
return haystack;
}
if(haystacklen == 0)
{
return NULL;
}
if(needlelen == 0)
{
return haystack;
}
if(needlelen > haystacklen)
{
return NULL;
}
endp = haystack + haystacklen - needlelen;
endq = needle + needlelen;
for(p = haystack; p <= endp; p++)
{
found = 1;
cmpp = p;
for(q = needle; q < endq; q++)
{
if(*cmpp != *q)
{
found = 0;
break;
}
else
{
cmpp++;
}
}
if(found)
{
return (void*)p;
}
}
return NULL;
}