Skip to content

Instantly share code, notes, and snippets.

@inv2004
Created April 3, 2021 22:17
Show Gist options
  • Save inv2004/1eb7e94b7353ab643c4d583e15d236fa to your computer and use it in GitHub Desktop.
Save inv2004/1eb7e94b7353ab643c4d583e15d236fa to your computer and use it in GitHub Desktop.
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, tag2__eD00OL9aGxJKms4Pcav4Eew)(tyObject_StreamFix2__puuL7GxzNXmsnKOJJ8DRDw* f, NimStringDesc* tag) {
NimStringDesc* result;
size_t tLen;
NIM_CHAR* tAddr;
{ result = (NimStringDesc*)0;
tLen = ((size_t) ((tag ? tag->Sup.len : 0)));
tAddr = (&tag->data[((NI) 0)]);
{
while (1) {
if (!((*f).pos < (*f).last)) goto LA2;
{
int T5_;
void* nextAddr;
NI len;
T5_ = (int)0;
T5_ = memcmp((*f).pos, ((void*) (tAddr)), tLen);
if (!(((NI32) 0) == T5_)) goto LA6_;
(*f).pos = ((void*) ((NU)((NU64)(((NU) (ptrdiff_t) ((*f).pos))) + (NU64)(tLen))));
nextAddr = memchr((*f).pos, 1, ((size_t) (((NI) 1000))));
len = (NI)(((NI) (ptrdiff_t) (nextAddr)) - ((NI) (ptrdiff_t) ((*f).pos)));
result = mnewString(((NI) (len)));
copyMem__i80o3k0SgEI5gTRCzYdyWAsystem(((void*) ((&result->data[((NI) 0)]))), (*f).pos, ((NI) (len)));
goto BeforeRet_;
}
goto LA3_;
LA6_: ;
{
(*f).pos = memchr((*f).pos, 1, ((size_t) (((NI) 1000))));
(*f).pos = ((void*) ((NU)((NU64)(((NU) (ptrdiff_t) ((*f).pos))) + (NU64)(((NU) 1)))));
}
LA3_: ;
} LA2: ;
}
}BeforeRet_: ;
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment